{"id":8468,"library":"pybboxes","title":"PyBBoxes: Light Weight Toolkit for Bounding Boxes","description":"PyBBoxes is a lightweight Python toolkit designed for handling bounding box operations. It provides abstractions for various bounding box formats (e.g., Pascal VOC, YOLO, COCO, Albumentations, FiftyOne) and allows for seamless conversions, common mathematical operations, scaling, clamping, and IoU computations. The current version is 0.2.0, and the library maintains an active release cadence with regular updates.","status":"active","version":"0.2.0","language":"en","source_language":"en","source_url":"https://github.com/devrimcavusoglu/pybboxes","tags":["bounding boxes","computer vision","annotations","object detection","image processing","data conversion"],"install":[{"cmd":"pip install pybboxes","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"The primary BoundingBox class is imported directly from the top-level package.","wrong":"from pybboxes.boxes import BoundingBox","symbol":"BoundingBox","correct":"from pybboxes import BoundingBox"},{"note":"As of v0.1.0, all functional computations (like IoU, shift, scale) were moved to the `pybboxes.functional` submodule.","wrong":"from pybboxes import bbox_iou","symbol":"bbox_iou","correct":"from pybboxes.functional import bbox_iou"},{"note":"The bbox_factory for generic box creation is imported from the top-level package.","wrong":"from pybboxes.factory import bbox_factory","symbol":"bbox_factory","correct":"from pybboxes import bbox_factory"}],"quickstart":{"code":"from pybboxes import BoundingBox\nfrom pybboxes.functional import bbox_iou\n\n# Example coordinates: (x_min, y_min, x_max, y_max)\nvoc_bbox_values = (10, 20, 100, 120)\nimage_size = (640, 480) # (width, height)\n\n# Create a BoundingBox object from Pascal VOC format\n# 'strict=False' is the default since v0.1.5, allowing out-of-bounds boxes\nbbox1 = BoundingBox(voc_bbox_values, image_size=image_size, from_type=\"voc\")\n\nprint(f\"Original VOC (bbox1): {bbox1.values}\")\nprint(f\"Normalized (bbox1): {bbox1.to_yolo().values}\")\n\n# Convert to another format, e.g., YOLO\nyolo_bbox = bbox1.to_yolo()\nprint(f\"Converted YOLO (bbox1): {yolo_bbox.values}\")\nprint(f\"Type: {yolo_bbox.box_type}\")\n\n# Perform a functional operation, e.g., Intersection over Union (IoU)\n# Note: functional methods moved to pybboxes.functional in v0.1.0\nbbox2_values = (15, 25, 105, 115)\nbbox2 = BoundingBox(bbox2_values, image_size=image_size, from_type=\"voc\")\n\niou = bbox_iou(bbox1, bbox2)\nprint(f\"IoU between bbox1 and bbox2: {iou:.4f}\")\n\n# Example of scaling and clamping\nscaled_bbox = bbox1.scale(scale=1.2)\nprint(f\"Scaled bbox1 (1.2x): {scaled_bbox.values}\")\n\nclamped_bbox = scaled_bbox.clamp()\nprint(f\"Clamped scaled bbox1 (to {image_size}): {clamped_bbox.values}\")","lang":"python","description":"This quickstart demonstrates how to create a `BoundingBox` object from Pascal VOC coordinates, convert it to YOLO format, calculate Intersection over Union (IoU) with another box, and apply scaling and clamping operations. It highlights the use of both the `BoundingBox` class and functions from `pybboxes.functional`."},"warnings":[{"fix":"If your code relies on strict boundary checking, explicitly set `strict=True` when creating `BoundingBox` objects or performing conversions. If you previously handled `OutOfBoundsError` and now want the non-strict behavior, you might need to adjust.","message":"The default value of the `strict` parameter for `BoundingBox` and conversion methods changed from `True` to `False` in v0.1.5. This means out-of-bounds boxes are now allowed by default instead of raising an error.","severity":"breaking","affected_versions":">=0.1.5"},{"fix":"Update your imports to fetch functional methods from `pybboxes.functional` (e.g., `from pybboxes.functional import bbox_iou`).","message":"All functional computations (e.g., `bbox_iou`, `bbox_shift`, `bbox_scale`) were moved from the top-level `pybboxes` module to the `pybboxes.functional` submodule.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Upgrade your Python environment to version 3.8 or higher. If you need to use an older Python version, you must use an older `pybboxes` release (e.g., v0.1.1 supported Python 3.6).","message":"Support for Python 3.6 was dropped in v0.1.6. As of v0.2.0, the library explicitly requires Python 3.8 or newer.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Review calls to `from_array()` if you are providing multidimensional inputs and verify the output is as expected. Refer to documentation for supported input shapes for specific box types.","message":"The `from_array()` method, introduced in v0.2.0, now supports multidimensional input. While this adds flexibility, ensure your input arrays match the expected (N, 4) or (N, H, W, 4) shapes to avoid unexpected parsing.","severity":"gotcha","affected_versions":">=0.2.0"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Change your import statement from `from pybboxes import bbox_iou` to `from pybboxes.functional import bbox_iou`.","cause":"Functional methods like `bbox_iou` were moved from the top-level `pybboxes` module to the `pybboxes.functional` submodule in version 0.1.0.","error":"AttributeError: module 'pybboxes' has no attribute 'bbox_iou'"},{"fix":"Upgrade your Python environment to 3.8 or newer. If upgrading Python is not an option, you would need to install an older compatible version of `pybboxes` (e.g., `pip install pybboxes<0.2.0` for Python 3.7).","cause":"Versions of `pybboxes` 0.2.0 and later explicitly require Python 3.8 or higher. Python 3.6 support was dropped in v0.1.6.","error":"ERROR: Package 'pybboxes' requires a different Python; you have 3.7.x but 'pybboxes' requires >=3.8"},{"fix":"As of v0.1.5, the default `strict` parameter changed to `False`. To replicate the older behavior, set `strict=True` explicitly. If you want to allow out-of-bounds boxes and clamp them, ensure `strict=False` (the new default) and use the `.clamp()` method if needed.","cause":"This error likely occurs in versions prior to 0.1.5 where `strict=True` was the default. If your bounding box coordinates exceed image dimensions, it raises an error.","error":"ValueError: Bounding box values are out of bounds for image (width, height): (640, 480)."}]}