HumanSignal / label-studio-converter

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

To/From COCO conversion ignores images with no annotations #165

Open alexmadey-oc opened 1 year ago

alexmadey-oc commented 1 year ago

I have noticed that converting COCO to LabelStudio and LabelStudio to COCO both ignore images without annotations. For example, if I have a COCO JSON and some of the images don't have corresponding annotations, the converter output will not have LabelStudio tasks for those images. The same is true if LabelStudio has some tasks without annotation and I try to export to COCO. The images from empty tasks will be missing in the exported COCO JSON.

makseq commented 1 year ago

1 Seems the first problem is happening here: https://github.com/heartexlabs/label-studio-converter/blob/master/label_studio_converter/imports/coco.py#L164 If you could contribute and fix this, it would be great!

2 You can try to solve the second problem with export to COCO by calling export API manually with download_all_tasks=1: https://api.labelstud.io/#operation/api_projects_export_read

/api/projects/{id}/export?download_all_tasks=1