{"id":46083894,"url":"https://github.com/tensorturtle/rebox","last_synced_at":"2026-03-01T16:17:04.281Z","repository":{"id":48424717,"uuid":"384177850","full_name":"tensorturtle/rebox","owner":"tensorturtle","description":"Easily convert between bounding box annotation formats.","archived":false,"fork":false,"pushed_at":"2022-01-07T14:23:35.000Z","size":1188,"stargazers_count":22,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-24T11:53:39.338Z","etag":null,"topics":["annotation","bounding-boxes","computer-vision","labeling-tool","object-detection","yolov5"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tensorturtle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-08T15:57:53.000Z","updated_at":"2025-02-20T23:56:04.000Z","dependencies_parsed_at":"2022-09-01T20:24:15.555Z","dependency_job_id":null,"html_url":"https://github.com/tensorturtle/rebox","commit_stats":null,"previous_names":["tensorturtle/bboxconvert"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tensorturtle/rebox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensorturtle%2Frebox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensorturtle%2Frebox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensorturtle%2Frebox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensorturtle%2Frebox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tensorturtle","download_url":"https://codeload.github.com/tensorturtle/rebox/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensorturtle%2Frebox/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29974700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T15:41:30.362Z","status":"ssl_error","status_checked_at":"2026-03-01T15:37:07.343Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["annotation","bounding-boxes","computer-vision","labeling-tool","object-detection","yolov5"],"created_at":"2026-03-01T16:17:03.712Z","updated_at":"2026-03-01T16:17:04.269Z","avatar_url":"https://github.com/tensorturtle.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rebox: Easily convert between bounding box formats\n\n[![Build](https://github.com/tensorturtle/rebox/actions/workflows/build.yml/badge.svg)](https://github.com/tensorturtle/rebox/actions)\n[![codecov](https://codecov.io/gh/tensorturtle/rebox/branch/main/graph/badge.svg?token=H7HTDYNIAV)](https://codecov.io/gh/tensorturtle/rebox) \n[![codacy](https://img.shields.io/codacy/grade/b16458c671284c5e98c65e6124ad4c79)](https://app.codacy.com/gh/tensorturtle/rebox/dashboard)\n\nFluidly convert between 2D rectangular bounding box annotation formats.\n\nInstead of writing yet more utility functions to convert between bounding box formats and perform common operations using them, use this instead.\n\nThere's nothing magical about this package, it really is just meant to replace boilerplate code.\n\n## Quickstart\n\n**Install with pip:**\n```bash\npip install rebox\n```\n\n**Convert a bounding box from COCO format to VOC_PASCAL format**:\n```py\n\u003e\u003e from rebox import BBox\n\u003e\u003e from rebox.formats import coco, pascal\n\n\u003e\u003e coco_bbox = BBox([40,50,20,15], coco)\n\u003e\u003e pascal_bbox = coco_bbox.as_format(pascal)\n\n\u003e\u003e pascal_bbox\n\"Coordinates: [40 50 59 64], Style: XYXY, Scale: None\"\n\n\u003e\u003e pascal_bbox.value\n[40 50 59 64]\n```\n\n## Supported Bounding Box Formats\n\nCommon formats such as YOLO, COCO, PASCAL_VOC, Albumentations, and Label Studio are provided as a convenience. If you wish to make your own coordinates format, instantiate the BBoxFormat class.\n\n|                \t|               Scale              \t|           Style          \t|\n|--------------:\t|:--------------------------------:\t|:-------------------------------------:\t|\n|      **YOLO**      \t|         Normalized (0,1)        \t| `[ x_Center, y_Center, width, height ]` \t|\n|      **COCO**      \t| Pixels                         \t|    `[ x_min, y_min, width, height ]`    \t|\n|   **PASCAL_VOC**   \t| Pixels                         \t|     `[ x_min, y_min, x_MAX, y_MAX ]`    \t|\n| **Albumentations** \t|         Normalized (0,1)         \t|     `[x_min, y_min, x_MAX, y_MAX ]`    \t|\n| **Label Studio**    | Normalized percentage (0, 100)    |     `[x_min, y_min, width, height]`     |\n\nInspired by [varunagrawal/bbox](https://github.com/varunagrawal/bbox). `bbox` is not flexible enough to accomodate the various format schemes.\n\n## Usage\n\n### Creating a `BBox` and access/modifing its attributes\n\n```py\n# readme_examples/create_bbox.py\n\nfrom rebox import BBox\nfrom rebox.formats import coco\n\ncoco_bbox = BBox([40,50,20,15], coco)\n\nprint(coco_bbox.format.style) # XmYmWH\nprint(coco_bbox.format.scale) # None\nprint(coco_bbox.x1) # 40\nprint(coco_bbox.y1) # 50\nprint(coco_bbox.w) # 20\nprint(coco_bbox.h) # 15\n\n# set values\ncoco_bbox.x1 = 60\nprint(coco_bbox.x1) # 60\n\n\n```\n\nThese attributes are only implemented for the current format,\nand are not automatically converted. For example, trying to access `x2` for a `XmYmWH` format returns `AttributeError`.\n\n### Converting between the same absolute/relative formats\n\nThe simplest conversion keeps the same scale, but with different styles:\n\n```py\n# readme_examples/simple_conversion.py\n\nfrom rebox import BBox\nfrom rebox.formats import coco, pascal\n\ncoco_bbox = BBox([40,50,20,15], coco)\npascal_bbox = coco_bbox.as_format(pascal)\n\nprint(pascal_bbox) # \"Coordinates: [40 50 59 64], Style: XYXY, Scale: None\"\nprint(pascal_bbox.value) # [40 50 59 64]\n\n```\n\n### Converting across absolute/relative formats\n\nThis time, pass in image height and width, to convert across pixel values and relative scale values.\n\n```py\n# readme_examples/absolute_relative_conversion.py\n\nfrom rebox import BBox\nfrom rebox.formats import yolo, coco\n\nimage_height = 360 # pixels\nimage_width = 640 # pixels\n\nyolo_bbox = BBox([0.31, 0.5, 0.2, 0.6], yolo) # using built-in 'yolo_format'\n\ncoco_bbox = yolo_bbox.as_format(coco, image_width, image_height) # to convert to built-in format 'coco'\n\nprint(coco_bbox.value) # array([134.4,  72. , 128. , 216. ])\n\n```\n\n### Operations on `BBox`es\n\n`rebox` includes several common utility operations on bounding boxes.\n\n#### IOU (Intersection over Union) of two bounding boxes\n\n```py\n# readme_examples/iou.py\n\nfrom rebox import BBox\nfrom rebox.formats import coco, pascal\nfrom rebox.ops import iou\n\none_bbox = BBox([40,50,20,10], coco)\ntwo_bbox = BBox([45,60, 30, 20], pascal)\n\niou = iou(one_bbox, two_bbox)\n\n```\n\nIf you would like to see more operations, please submit an Issue.\n\n## Development \n\nI organized often-used commands into scripts.\n\n`bump_0.1_patch.sh` increments the 'patch' version (last place)\n\n`pypi_build.sh` creates a new distro wheel\n\n`pypi_upload.sh` uses twine to upload to pypi\n\n`testpypi_upload.sh` is for uploading to test pypi\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftensorturtle%2Frebox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftensorturtle%2Frebox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftensorturtle%2Frebox/lists"}