Skip to content
Open
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
4 changes: 2 additions & 2 deletions tools/dataset_converters/labelstudio2coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def add_image(images, width, height, image_id, image_path):

for item_idx, item in enumerate(ann_list):
# each image is an item
image_name = item['file_upload']
image_name = item['data']['img']
image_id = len(images)
width, height = None, None

Expand Down Expand Up @@ -143,7 +143,6 @@ def add_image(images, width, height, image_id, image_path):
images = add_image(images, width, height, image_id,
image_name)

category_id = self.category_name_to_id[category_name]

annotation_id = len(annotations)

Expand Down Expand Up @@ -201,6 +200,7 @@ def add_image(images, width, height, image_id, image_path):

# create new annotation in coco
# when the keypoint is the first point of an instance
category_id = self.category_name_to_id[category_name]
if i == 0 or item['annotations'][0]['result'][
i - 1]['type'] != 'keypointlabels':
annotations.append({
Expand Down