Open GabrielDornelles opened 2 years ago
You need to do something like this
python -m venv env
source env/bin/activate
git clone https://github.com/heartexlabs/label-studio-converter.git
cd label-studio-converter
pip install -e .
label-studio-converter import coco -h # just print help
label-studio-converter import coco -i your-input-file.json -o output.json
then the converter prints instructions how to import a converted file to Label Studio. You will get output.json and label config XML file, so you need to 1 setup a new project in LS 2 set the label config 3 import output.json file
Related question: https://github.com/heartexlabs/label-studio/issues/808 Related PR: https://github.com/heartexlabs/label-studio-converter/pull/46
Thanks! One more question if possible:
How should be the image path in this Label studio format?
I'm not getting the images with the annotations when loading
Nvm! I've figured it out, it works with the path above, as long as I add that absolute path in the storage settings via UI
Hi @GabrielDornelles @makseq,
I have added local storage path "/home/anang/images" in the settings and synced the local path to get the images. I am facing issue after importing the output.json file in label studio. The images are not getting imposed with the annotations on importing the output.json, instead I am getting new tasks from output.json resulting in duplicate tasks for the images. Below is the screen shots.
Can you please help me on how I can get the images loaded correctly with annotations in label studio
Hi @GabrielDornelles @makseq,
I have added local storage path "/home/anang/images" in the settings and synced the local path to get the images. I am facing issue after importing the output.json file in label studio. The images are not getting imposed with the annotations on importing the output.json, instead I am getting new tasks from output.json resulting in duplicate tasks for the images. Below is the screen shots.
Can you please help me on how I can get the images loaded correctly with annotations in label studio
Hi Anang!
From what I remember doing I've done this path:
LOCAL_FILES_SERVING_ENABLED
flag before launching label-studio (export LOCAL_FILES_SERVING_ENABLED=1
or add it in .bashrc
)That done, everything worked as expected
Hi Gabriel,
Thanks for reverting back. I followed these steps. But the issue was it seems with the image path in the output.json file created from label-studio-converter. I modified the path to make it point to the correct images directory path and it is working fine now.
good job
Hey, I just imported this output.json to labelstudio, I can see images with annotations, but annotations are grey - not linked to classes ("rectanglelabels"). I have correct labeling interface. I dont know what I did wrong.
output.json: [ { "data": { "image": "/data/local-files/?d=FF\TEST\0006.png" }, "annotations": [ { "result": [ { "id": "eabad6846a", "type": "rectanglelabels", "value": { "x": 6.702127659574467, "y": 16.1507402422611, "width": 24.042553191489365, "height": 31.493943472409146, "rotation": 0, "rectanglelabels": "2salat" }, "to_name": "image", "from_name": "label_rectangles", "image_rotation": 0, "original_width": 2050, "original_height": 1620 } ]
Hi Gabriel,
Thanks for reverting back. I followed these steps. But the issue was it seems with the image path in the output.json file created from label-studio-converter. I modified the path to make it point to the correct images directory path and it is working fine now.
Hi, I also follow that steps and modified the path to point to the correct images directory path in the JSON file, but still got that issue. The path is "/home/ubuntu/paddle/PaddleDetection/label_studio_test/"
Hey, I just imported this output.json to labelstudio, I can see images with annotations, but annotations are grey - not linked to classes ("rectanglelabels"). I have correct labeling interface. I dont know what I did wrong.
output.json: [ { "data": { "image": "/data/local-files/?d=FF\TEST\0006.png" }, "annotations": [ { "result": [ { "id": "eabad6846a", "type": "rectanglelabels", "value": { "x": 6.702127659574467, "y": 16.1507402422611, "width": 24.042553191489365, "height": 31.493943472409146, "rotation": 0, "rectanglelabels": "2salat" }, "to_name": "image", "from_name": "label_rectangles", "image_rotation": 0, "original_width": 2050, "original_height": 1620 } ]
I had the same problem: for me the issue was that I needed to include the XML as a custom template under "labelling setup" when you create a project. I used label-studio-converter to convert some COCO annotations to label studio JSON. This creates a json file, but also an xml file. Copy and past the contents of the XML in the labelling setup tab.
My COCO dataset JSON file contains empty list of segmentations...
WARNING:root:Segmentation in COCO is experimental
Traceback (most recent call last):
File "/home/frta/.local/bin/label-studio-converter", line 33, in <module>
sys.exit(load_entry_point('label-studio-converter', 'console_scripts', 'label-studio-converter')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/frta/projects/***-pose-estimation/label-studio-converter/label_studio_converter/main.py", line 189, in main
imports(args)
File "/home/frta/projects/***-pose-estimation/label-studio-converter/label_studio_converter/main.py", line 171, in imports
import_coco.convert_coco_to_ls(
File "/home/frta/projects/***-pose-estimation/label-studio-converter/label_studio_converter/imports/coco.py", line 219, in convert_coco_to_ls
item = create_segmentation(
^^^^^^^^^^^^^^^^^^^^
File "/home/frta/projects/***-pose-estimation/label-studio-converter/label_studio_converter/imports/coco.py", line 54, in create_segmentation
segmentation = annotation['segmentation'][0]
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
After reading everyone's responses, I have a few small questions, I hope you can help me I have an annotation model, it generates a COCO annotation file, I want to import the coco annotation file in Label-studio to further verify and improve the accuracy of the model annotation, how to import the coco json file into the project? Oh yes, I'm using a Linux operating system, and LS is installed with pip
You need to do something like this你需要做这样的事情
python -m venv env source env/bin/activate git clone https://github.com/heartexlabs/label-studio-converter.git cd label-studio-converter pip install -e . label-studio-converter import coco -h # just print help label-studio-converter import coco -i your-input-file.json -o output.json
then the converter prints instructions how to import a converted file to Label Studio. You will get output.json and label config XML file, so you need to然后转换器会打印有关如何将转换后的文件导入 Label Studio 的说明。你会得到 output.json 和标签配置 XML 文件,所以你需要 1 setup a new project in LS1 在 LS 中设置一个新项目 2 set the label config2 设置标签配置 3 import output.json file3 导入output.json文件
Related question: #808 相关问题:#808 Related PR: HumanSignal/label-studio-converter#46相关公关:HumanSignal/label-studio-converter#46
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'
I have a COCO annotation file for my dataset (generated by my model). I want to refine the predicted bounding boxes. How do I import the coco format json file into the project? I've seen this Label-studio-converter but I don't know how to use it for this case.