Lightweight toolkit for bounding boxes providing conversion between bounding box types and simple computations.
Supported Bounding Box Types
- Albumentations: Albumentations Format
- COCO: COCO (Common Objects in Context)
- FiftyOne: FiftyOne
- PASCAL VOC: Pascal VOC
- YOLO: YOLO
Installation
To install PyBboxes, use pip for a quick setup:
pip install pybboxes
Alternatively, you can build it from the source:
git clone https://github.com/devrimcavusoglu/pybboxes.git
cd pybboxes
python setup.py install
Creating and Using Bounding Boxes
Creating a bounding box is as simple as:
from pybboxes import BoundingBox
my_coco_box = [98, 345, 322, 117]
coco_bbox = BoundingBox.from_coco(*my_coco_box)
Think of it as putting an envelope inside a mailbox. The envelope (bounding box) fits perfectly according to the provided coordinates.
Out of Bounds (OOB) Boxes
Pybboxes supports the concept of out-of-bounds (OOB) boxes. Using the strict
keyword, you can determine how strict the bounding box creation will be:
coco_bbox = BoundingBox.from_coco(*my_coco_box, image_size=image_size, strict=False)
Here, setting strict
to False allows OOB boxes. Envision this as allowing letters that are bigger than the mailbox to also be accepted without complaint.
Conversions and Computations
With PyBboxes, converting between bounding box formats is a breeze!
voc_bbox = coco_bbox.to_voc()
yolo_bbox = coco_bbox.to_yolo(image_size=(640, 480))
It’s like translating a letter from one language to another; it keeps the message intact but changes its native format.
Troubleshooting
In case you encounter issues, here are some tips:
- Error Messages: Read any error messages you receive. They often provide clues about what went wrong.
- Dependencies: Ensure all necessary dependencies and correct Python versions are in place as support for Python3.8 will drop in future releases.
- Out of Bounds: If you are unsure whether a box is OOB, check the
is_oob
property. Also, ensure you specifyimage_size
when necessary to avoid conversion errors.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Final Notes
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.