HumanSignal / label-studio-converter

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

"RLE" doesn't exist in result dict but in result["value"] dict #167

Closed Glaadiss closed 1 year ago

Glaadiss commented 1 year ago

https://github.com/heartexlabs/label-studio-converter/blob/bdfe8a04680135c1b22bf56d7f2bc792c7b4e079/label_studio_converter/brush.py#L112

Hi, I've been running this code recently and there's different structure for result dict.

When I checked the structure of the result in exported json for segmentation task it looks like this:

                    {
                        "original_width": 800,
                        "original_height": 896,
                        "image_rotation": 0,
                        "value": {
                            "format": "rle",
                            "rle": [
                                0,
                                43,
                                192,
                            ],
                            "brushlabels": [
                                "handler_side"
                            ]
                        },
                        "id": "BiWtsLyf7I",
                        "from_name": "tag",
                        "to_name": "image",
                        "type": "brushlabels",
                        "origin": "manual"
                    }

Thus in the code above we should reference result["value"]["rle"] instead of result["rle"]

makseq commented 1 year ago

Please check this comment: https://github.com/heartexlabs/label-studio-converter/pull/82#issuecomment-1025969634 + this issue https://github.com/heartexlabs/label-studio-converter/issues/81

You should apply this one https://github.com/heartexlabs/label-studio-converter/blob/master/label_studio_converter/converter.py#L305 to your annotations and then send the output to brush converter.