Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COCO export fails due to mask size exceeding image dimensions #9316

Closed
2 tasks done
ElhamAlfuqara opened this issue Apr 9, 2025 · 2 comments
Closed
2 tasks done

COCO export fails due to mask size exceeding image dimensions #9316

ElhamAlfuqara opened this issue Apr 9, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@ElhamAlfuqara
Copy link

ElhamAlfuqara commented Apr 9, 2025

Actions before raising this issue

  • I searched the existing issues and did not find anything similar.
  • I read/searched the docs

Steps to Reproduce

Issue Summary:
After completing a segmentation task (masks) using auto-labeling followed by manual review and corrections of more than 1000 images, I encountered an error when attempting to export the dataset in COCO format. The export to CVAT format works correctly, but exporting to COCO format fails with the following error:
ValueError: could not broadcast input array from shape (220,264) into shape (219,264)

The steps I followed:

  1. Perform auto-labeling for a segmentation task.
  2. Manually revise and correct labels across ~1000 images.
  3. Attempt to export the annotated dataset to COCO format.
    4.Export to cvat and try to solve the issue manully

Expected Behavior

Successful export of the dataset to COCO format.

Possible Solution

To prevent this issue, it would be helpful if CVAT ensures that generated masks do not exceed the image dimensions either by clipping or resizing the mask accordingly before export.

Context

No response

Environment

@ElhamAlfuqara ElhamAlfuqara added the bug Something isn't working label Apr 9, 2025
@bsekachev
Copy link
Member

CVAT ensures that generated masks do not exceed

It, actually, ensures. You may try to draw a mask in UI and it will fit into image dimensions.
Do you have any data to reproduce the issue (e.g. task backup)?

@ElhamAlfuqara
Copy link
Author

Thank you for your response.
After further debugging, it appears that the issue was caused by the auto-labeling process(add1 pixel either to the right or bottom of the mask). The dataset contains over 35,000 annotations, and the problem occurred in 1,950 of them, all of which were auto-labeled. After removing these masks and re-annotating them using the SAM model, the issue was resolved.
At this point, we need to review the code we used for deploying the model with CVAT to ensure this doesn’t happen again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants