HumanSignal / HumanSignal/label-studio
Exporting tasks for specific task IDs exports all task annotations instead
- Dominant language
- TypeScript
- Stars
- 28.3k
- Forks
- 3.7k
- Avg merge
- 14h
- Merged PRs (30d)
- 15
Description
Hello,
I have set up a Label Studio project, where I have set up a `choices` annotation in the xml configuration file which can be either `Yes` or `No`. I want to export a COCO dataset which will contain the annotations only for the tasks that have been labeled as `Yes`. My code is the following:
```
# Get project
project = ls.get_project(id=id)
# Get labeled tasks
labeled_tasks = project.get_labeled_tasks()
# Filter tasks based on "Yes"
filtered_task_ids = []
for task in labeled_tasks:
task_annotations = task["annotations"][0]["result"]
filtered_annotation = [annotation["value"]["choices"][0] for annotation in task_annotations if annotation["type"] == "choices"]
if filtered_annotation == ["Yes"]:
filtered_task_ids.append(task["id"])
project.export_tasks(ids=filtered_task_ids, export_type="COCO", export_location=download_path, download_all_tasks=False)
```
In my example project, `filtered_task_ids` contains 2 IDs, while the project contains 95 tasks. While I would expect that the generated COCO file will contain the annotations only for these 2 tasks, it contains the annotations for all 95.
Am I missing the intended behavior of the `ids` argument or is there an issue with either my code or with `export_tasks()`?
Contributor guide
Assessment
This issue has not been assessed yet.