Skip to main content

Evaluation toolkit for neural language generation.

Project description

PyBboxes

Python Toolkit for Bounding Boxes providing conversion between bounding box types. Supported bounding box types:

Installation

Through pip (recommended),

pip install pybboxes

or build from source,

git clone https://github.com/devrimcavusoglu/pybboxes.git
cd pybboxes
python setup.py install

Conversion

You are able to convert from any bounding box type to another.

import pybboxes as pbx

coco_bbox = (1,2,3,4)  # COCO Format bbox as (x-tl,y-tl,w,h)
voc_bbox = (1,2,3,4)  # Pascal VOC Format bbox as (x-tl,y-tl,x-br,y-br)
pbx.convert_bbox(coco_bbox, from_type="coco", to_type="voc")  # (1, 2, 4, 6)
pbx.convert_bbox(voc_bbox, from_type="voc", to_type="coco")  # (1, 2, 2, 2)

Some formats require image width and height information for scaling, e.g. YOLO bbox (resulting are round coordinates are rounded to 2 decimals to ease reading).

import pybboxes as pbx

voc_bbox = (1,2,3,4)  # Pascal VOC Format bbox as (x-tl,y-tl,x-br,y-br)
pbx.convert_bbox(voc_bbox, from_type="voc", to_type="yolo", image_width=28, image_height=28)  # (0.07, 0.11, 0.07, 0.07)

Computation

You can also make computations on supported bounding box formats.

import pybboxes as pbx

coco_bbox = (1,2,3,4)  # COCO Format bbox as (x-tl,y-tl,w,h)
voc_bbox = (1,2,3,4)  # Pascal VOC Format bbox as (x-tl,y-tl,x-br,y-br)
pbx.compute_area(coco_bbox, bbox_type="coco")  # 12
pbx.compute_area(voc_bbox, bbox_type="voc")  # 4

Tests

To tests simply run.

python tests/run_tests.py

Code Style

To check code style,

python tests/run_code_style.py check

To format codebase,

python tests/run_code_style.py format

License

Licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pybboxes-0.0.1.tar.gz (8.7 kB view hashes)

Uploaded Source

Built Distribution

pybboxes-0.0.1-py3-none-any.whl (11.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page