You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am trying to format the rl-encoded masks I created an exported from label-studio (as json) to numpy arrays. I could also export them directly as numpy files but then I would need to map my data to the annotations manually, requiring again the json. So I tried to use the decode_from_annotation function from label-studio-sdk/src/label_studio_sdk/converter/brush.py on the list of result dicts of the loaded json. However, my json has a different format than expected from the decode_from_annotation function. More precisely, the function expects the dictionary to contain a key 'rle' but in my case the 'rle' key is one layer below within the dict of the 'value' key.
Here an example code:
import json
from label_studio_converter.brush import decode_from_annotation
json_file = '/path/to/label-studio.json'
with open(json_file, 'r') as file:
labels_json = json.load(file)
print(labels_json[0]['annotations'][0]['result'][0].keys())
print(labels_json[0]['annotations'][0]['result'][0]['value'].keys())
decode_from_annotation('some_name', labels_json[0]['annotations'][0]['result'])
I am not sure if my json format is wrong (but that is how I got it from label-studio) or if the format has changed and not been updated in this particular function. Right now I just copied the function and changed the keys and then it works.
Hi, I am trying to format the rl-encoded masks I created an exported from label-studio (as json) to numpy arrays. I could also export them directly as numpy files but then I would need to map my data to the annotations manually, requiring again the json. So I tried to use the decode_from_annotation function from label-studio-sdk/src/label_studio_sdk/converter/brush.py on the list of result dicts of the loaded json. However, my json has a different format than expected from the decode_from_annotation function. More precisely, the function expects the dictionary to contain a key 'rle' but in my case the 'rle' key is one layer below within the dict of the 'value' key.
Here an example code:
This is what I get:
I am not sure if my json format is wrong (but that is how I got it from label-studio) or if the format has changed and not been updated in this particular function. Right now I just copied the function and changed the keys and then it works.
Versions:
label-studio: v1.13.1
label-studio-sdk: v1.0.8
The text was updated successfully, but these errors were encountered: