Bug during as_coco()
conversion for segmentation (+ solution)
#1085
Labels
bug
Something isn't working
as_coco()
conversion for segmentation (+ solution)
#1085
Search before asking
Bug
Ce problème fait suite au travail fait sur mon précédent issue #1052
results.as_coco(annotations_path="test_coco/", min_image_area_percentage=0.01,)
The problem is due to the fact that in certain cases, the mask returned by GroundedSam is completely inconsistent (less than 3 pixels for example). In this specific case, the function approximate_mask_with_polygons() (as_coco() > detections_to_coco_annotations() > approximate_mask_with_polygons()) returns an empty array.
So, the line
causes my error, because there is no item '0' in an empty list.
I will propose a fix following the writing of this issue.
I changed the architecture of the as_coco() function to be the same as the as_yolo() and as_pascal_voc() architecture.
Environment
Supervision 0.19.0
Minimal Reproducible Example
Image to use :

Additional
In the code that I am going to propose, as_coco() will record either the BoundingBoxes coordinates or the Segmentation coordinates, but not both at the same time.
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: