HumanSignal / label-studio-converter

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

Convert polygon masks to COCO format #148

Closed saskra closed 1 year ago

saskra commented 2 years ago

I want to convert the JSON files with my polygon annotations from LabelStudio to COCO compatible files and I followed this example to do so: https://github.com/heartexlabs/label-studio-converter#coco

However, the result looks like this:

{
  "images": [],
  "categories": [
    {
      "id": 0,
      "name": "Hello"
    },
    {
      "id": 1,
      "name": "World"
    }
  ],
  "annotations": [],
  "info": {
    "year": 2022,
    "version": "1.0",
    "description": "",
    "contributor": "Label Studio",
    "url": "",
    "date_created": "2022-10-31 15:14:38.319626"
  }
}

The most important thing is missing there, the points of the label. These are not the contents of the example file but only those of the configuration file from here: https://github.com/heartexlabs/label-studio/tree/61d883810eacabedfd0248eb3d851763924f07be/label_studio/examples/image_polygons

What do I have to do differently?

makseq commented 2 years ago

@saskra what if your labeling config? If there is a BrushLabels, it's not yet supported in COCO export.

saskra commented 2 years ago

I have both polygons and brush. However, this is about the general supplied example of LabelStudio and not my data, and already here I do not understand how it works because I do not find the mask in the output.

makseq commented 2 years ago

Masks won't be exported in COCO, because they are not supported in the converter. Polygons should be exported.