Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2956,7 +2956,7 @@ Export with specifying output directory and file name.
client.export_coco(project="YOUR_PROJECT_SLUG", tasks=tasks, output_dir="YOUR_DIRECTROY", output_file_name="YOUR_FILE_NAME")
```

If you would like to export pose estimation type annotations, please pass annotations.
If you would like to export pose estimation type annotations or bbox type annotations with keypoints, please pass annotations.

```python
project_slug = "YOUR_PROJECT_SLUG"
Expand Down
14 changes: 14 additions & 0 deletions examples/export_coco.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import fastlabel

client = fastlabel.Client()

project_slug = "YOUR_PROJECT_SLUG"
tasks = client.get_image_tasks(project=project_slug)
annotations = client.get_annotations(project=project_slug)

client.export_coco(
project=project_slug,
tasks=tasks,
annotations=annotations,
output_dir="./export_coco/",
)
2 changes: 1 addition & 1 deletion fastlabel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3136,7 +3136,7 @@ def export_coco(
) -> None:
"""
Convert tasks to COCO format and export as a file.
If you pass annotations, you can export Pose Estimation type annotations.
If you pass annotations, you can export Pose Estimation type annotations or Bbox type annotations with keypoints.

project is slug of your project (Required).
tasks is a list of tasks (Required).
Expand Down
5 changes: 4 additions & 1 deletion fastlabel/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,10 @@ def __get_coco_categories(tasks: list, annotations: list) -> list:
coco_skeleton = []
coco_keypoints = []
coco_keypoint_colors = []
if annotation["type"] == AnnotationType.pose_estimation.value:
if annotation["type"] in [
AnnotationType.pose_estimation.value,
AnnotationType.bbox.value,
]:
keypoints = annotation["keypoints"]
for keypoint in keypoints:
coco_keypoints.append(keypoint["key"])
Expand Down