HumanSignal / label-studio-converter

Tools for converting Label Studio annotations into common dataset formats
https://labelstud.io/
255 stars 132 forks source link

fix: check for empty segmentation key #238

Closed pztrick closed 4 months ago

pztrick commented 1 year ago

This fixes importing a COCO formatted file with an empty segmentation key, e.g.: {"segmentation":[]}.

Without this fix, the function create_segmentation blows up with an IndexError here:

https://github.com/HumanSignal/label-studio-converter/blob/83ac08ce3870de4bb04834314c017735c5f7bb04/label_studio_converter/imports/coco.py#L54

ScrambledRK commented 1 year ago

Had the same issue and can confirm that the changed line in this PR works.

I was converting "VOC to COCO" and this conversion preserved empty segmentation data. I am not really familiar with either data format so I don't know if segmentation is allowed to be empty or should be removed entirely.

niklub commented 4 months ago

We introduced this update in the upcoming label-studio-sdk>=1. Thanks for noticing this bug! Closing this PR for now, but feel free to submit your further suggestions and feedback in label-studio-sdk repo