HumanSignal / label-studio

Label Studio is a multi-type data labeling and annotation tool with standardized output format
https://labelstud.io
Apache License 2.0
19.35k stars 2.4k forks source link

How to convert COCO json to label studio json for polygon segmentation? #808

Closed shipra25jain closed 2 years ago

shipra25jain commented 3 years ago

Hello, thank you for the great tool!

I have some image segmentation annotations in format of polygon coco labels. I want to refine this annotations using your tool, so I converted them in the label studio json format. But when I import my converted json file along with input image, the interface only visualizes input image and in right it shows list of 25 polygons, but do not share there overlay on image. But when I import the annotations alone (no input image), I can see my segmentation mask in the interface.

I suspect that there could be one of the two problems :

  1. either your tool does not support overlaying imported segmentation mask (polygons) on images
  2. I referred to your "convert to coco" (opposite of what I want) functionality to convert my coco type annotation to label studio json and there you create points by dividing x, y coordinates by 100 and multiplying by width and height, do you think there is some problem there?

Thank you Shipra

twsl commented 3 years ago

In case the labels in the annotation do not match the ones you setup when creating your label config, all polygons are shown in light grey and are hardly visible. That is a problem I encountered. For the inverse conversion (COCO polygon points to LSCF) you need to convert via: p_new = (p*100)/widthOrHeight

makseq commented 2 years ago

WIP: https://github.com/heartexlabs/label-studio-converter/pull/69

Relative slack messages: https://label-studio.slack.com/archives/C01Q5G6NMKR/p1635364775100600 https://label-studio.slack.com/archives/C01Q5G6NMKR/p1634191067188200 https://label-studio.slack.com/archives/C01Q5G6NMKR/p1633643866097900 https://label-studio.slack.com/archives/C01Q5G6NMKR/p1633524757058200 https://label-studio.slack.com/archives/C01Q5G6NMKR/p1631207084176700 https://label-studio.slack.com/archives/C01Q5G6NMKR/p1627712907024300 https://label-studio.slack.com/archives/C01Q5G6NMKR/p1623703138466700?thread_ts=1623701999.463500&cid=C01Q5G6NMKR

makseq commented 2 years ago

Now COCO import is a part of label-studio-converter:

label-studio-converter import coco -h
taimaruuu commented 1 year ago

@shipra25jain how did you convert the coco annotations .json file into label studio json format?

jiangtangaaaa commented 1 year ago

@shipra25jain how did you convert the coco annotations .json file into label studio json format?你们是如何将 Coco Annotations .json 文件转换为 Label Studio JSON 格式的?

When I type label-studio-converter import coco -i result.json -o output.json Tip: with open(input_file, encoding='utf8') as f: FileNotFoundError: [Errno 2] No such file or directory: '/home/wjt/PycharmProjects/pythonProject/label-studio-converter/result.json'