Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: task_map expected string got int #2066

Closed
wants to merge 1 commit into from

Conversation

oddeirikigland
Copy link
Contributor

What changes are proposed in this pull request?

load_annotations from label studio do not brake

How is this patch tested? If it is not, please explain why.

Tested on develop branch

Release Notes

Is this a user-facing change that should be mentioned in the release notes?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release
    notes for FiftyOne users.

(Details in 1-2 sentences. You can just refer to another PR with a description
if this PR is part of a larger change.)

What areas of FiftyOne does this PR affect?

  • App: FiftyOne application changes
  • Build: Build and test infrastructure changes
  • Core: Core fiftyone Python library changes
  • Documentation: FiftyOne documentation changes
  • Other

To reproduce:

# pip install label-studio-sdk label-studio

import fiftyone as fo

d: fo.Dataset = fo.load_dataset(name="2022.09.07.10.41.35")
print(d.name, len(d))
anno_key = "asd123456"
# d.annotate(
#     anno_key=anno_key,
#     label_schema={"gt_b_box": {"type": "detections", "classes": ["something"]}},
#     launch_editor=True,
# )

# do the annotation

d.load_annotations(anno_key=anno_key)

"""
Downloading labels from Label Studio...
Traceback (most recent call last):
  File "/Users/oe/code/fiftyone/asd/asd_1.py", line 13, in <module>
    d.load_annotations(anno_key=anno_key)
  File "/Users/oe/code/fiftyone/fiftyone/core/collections.py", line 6998, in load_annotations
    return foua.load_annotations(
  File "/Users/oe/code/fiftyone/fiftyone/utils/annotations.py", line 1033, in load_annotations
    annotations = results.backend.download_annotations(results)
  File "/Users/oe/code/fiftyone/fiftyone/utils/labelstudio.py", line 142, in download_annotations
    annotations = api.download_annotations(results)
  File "/Users/oe/code/fiftyone/fiftyone/utils/labelstudio.py", line 432, in download_annotations
    labels = self._import_annotations(
  File "/Users/oe/code/fiftyone/fiftyone/utils/labelstudio.py", line 373, in _import_annotations
    sample_id = task_map[t["id"]]
KeyError: 3
"""

@ehofesmann
Copy link
Member

Hi @oddeirikigland, I wasn't able to recreate this error. What versions of label-studio and the label-studio-sdk are you running?

Also, could you provide the output of this:

results = d.load_annotation_results("asd123456")
print(results.uploaded_tasks)

@oddeirikigland
Copy link
Contributor Author

oddeirikigland commented Sep 8, 2022

label-studio 1.5.0.post0
label-studio-sdk 0.0.14

Output: {'6': '63185983fd67293713f93df4'}

@ehofesmann
Copy link
Member

Thanks for your help figuring this out @oddeirikigland! 🤗
I've opened #2074 with a slightly different way to fix this, so I'll go ahead and close this.

@ehofesmann ehofesmann closed this Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants