Skip to content

Conversation

@jveitchmichaelis
Copy link
Collaborator

@jveitchmichaelis jveitchmichaelis commented Jan 24, 2026

Description

Add support for bounding box loading in utilities.read_coco. Previously we assumed that MS-COCO files are for polygon labels, but as the linked issue correctly points out, bbox only is perfectly valid.

This PR checks to see if the segmentation key is present, if not, load bbox and convert to a shapely bbox instead. I've added an explicit box/task argument for read_coco. Currently we only really support boxes, but in future I would add the same to read_file to allow for the other tasks we're working on.

Also adds a test case.

Tested with OAM-TCD (which has both formats):

image image

Related Issue(s)

Fixes #1281

AI-Assisted Development

Autocomplete

  • I used AI tools (e.g., GitHub Copilot, ChatGPT, etc.) in developing this PR
  • I understand all the code I'm submitting
  • I have reviewed and validated all AI-generated code

AI tools used (if applicable):
Copilot in VS Code

@jveitchmichaelis jveitchmichaelis changed the title support coco bbox format Support MS-COCO bbox format Jan 24, 2026
@jveitchmichaelis jveitchmichaelis changed the title Support MS-COCO bbox format Support MS-COCO bbox field in read_coco Jan 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

utilities.read_file raises KeyError: 'segmentation' when loading valid COCO bbox annotations with segmentation

1 participant