Coco annotations wrong

i uploaded a coco zip file and although everything looks fine in the file (coordinates of the annotation polygones matches the shape of the objects), the actual polygon is not displayed correctly and way off. the bounding box is fine, thus why i’m completely without any clue what could be the problem.

i imported the exact same data into and there everything is shown fine. so this seems to be a bug in

maybe the coordinate system is wrong, because is see that the polygon seems to be rotated or something. i would normally think x:0,y:0 is at the top left. no? i mean for the bounding box it seems to work :wink:

here is the annotation file:

BTW: i created a ticket on your hubspot chat widget and haven’t heard back from you since a week or so. thus why i create this ticket now in the hope someone is finally answering…

Hello, apologies, I tried emailing you through the prior support ticket, but apparently it did not go through.

We’re looking into this issue and I’ll reach out when it’s fixed, but in the mean time, if you don’t have too many images, I would suggest deleting the bad segmentation instances and re-drawing the masks.

I also suspect that the issue is the large size of the images. The bounding boxes appear to rescale properly but the segmentation masks do not. You could try reducing the size of your images (and corresponding annotations) to less than 1000px by 1000px and re-uploading.

I’ll be in touch!

hey there,

i tried the same with smaller resolution (256px width) but it also does not work. See the archive here:

You can try it out yourself. The coordinates of the annotations are 100% correct.

PS: This happens with ALL images, so just deleting some images is not a solution for me. Currently i cannot test your system at all, i need to at least test it with 1000 images and don’t want to redraw the segments. We already did that locally ourself.


Hello, thank you for providing a sample COCO dataset for us to dig into. It looks like the coordinates of the annotations are correct, however, the height and width values specified in the image metadata are incorrect. We use those values to encode the polygon segmentation mask into a different format, so if the height and width in the metadata do not match the true height and width of the image, the segmentation mask will not be encoded correctly.

This is your example annotation file:

{'info': {'description': 'fileee document edges'},
 'images': [{'file_name': 'testdoc_0.jpg',
   'height': 305,
   'width': 223,
   'id': 1}],
 'annotations': [{'segmentation': [[223, 21, 237, 320, 15, 325, 20, 26]],
   'iscrowd': 0,
   'image_id': 1,
   'category_id': 1,
   'id': 1,
   'bbox': [15, 21, 223, 305],
   'area': 63560.0}],
 'categories': [{'id': 1, 'name': 'Document', 'supercategory': 'Document'}]}

According to this, the image height is 305 and the width is 223, but the actual image height is 341 and the width is 256. I edited the height and width in this file and verified that with the correct height and width, the segmentation mask is encoded correctly.

Would you mind correcting those metadata values for your images and re-uploading and letting me know if that solves the issue?

Hey Matt,

Good Catch, that was the issue! Now everything works. :slight_smile:

1 Like