label-studio-converter icon indicating copy to clipboard operation
label-studio-converter copied to clipboard

fix: check for empty segmentation key

Open pztrick opened this issue 1 year ago • 1 comments

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

pztrick avatar Aug 20 '23 21:08 pztrick

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.

ScrambledRK avatar Aug 31 '23 08:08 ScrambledRK

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

niklub avatar Jun 04 '24 15:06 niklub