Skip to content

Commit 931a218

Browse files
committed
bug fixed
1 parent 2853a9b commit 931a218

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

superannotate/input_converters/converters/coco_converters/coco_to_sa_pixel.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ def coco_panoptic_segmentation_to_sa_pixel(coco_path, images_path):
1515
hex_colors = blue_color_generator(len(coco_json["categories"]))
1616
annotate_list = coco_json["annotations"]
1717

18+
cat_id_to_cat = {}
19+
for cat in coco_json['categories']:
20+
cat_id_to_cat[cat['id']] = cat['name']
21+
1822
sa_jsons = {}
1923
for annotate in tqdm(annotate_list, "Converting"):
2024
annot_name = os.path.splitext(annotate["file_name"])[0]
@@ -39,6 +43,7 @@ def coco_panoptic_segmentation_to_sa_pixel(coco_path, images_path):
3943
axis=1)] = hex_to_rgb(hex_colors[i])
4044
dd = {
4145
"classId": seg["category_id"],
46+
'className': cat_id_to_cat[seg["category_id"]],
4247
"probability": 100,
4348
"visible": True,
4449
"parts": [{

superannotate/input_converters/converters/coco_converters/coco_to_sa_vector.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,19 @@ def coco_keypoint_detection_to_sa_vector(coco_path, images_path):
230230
}
231231
)
232232

233-
for point in sa_points:
234-
point_index = sa_points.index(point)
233+
for point_index, point in enumerate(sa_points):
234+
if sa_points[point_index] == (-17, -17):
235+
x = 5
236+
y = 5
237+
else:
238+
x = sa_points[point_index][0],
239+
y = sa_points[point_index][1]
240+
235241
sa_template['points'].append(
236242
{
237243
'id': point_index + 1,
238-
'x': sa_points[point_index][0],
239-
'y': sa_points[point_index][1]
244+
'x': x,
245+
'y': y
240246
}
241247
)
242248

0 commit comments

Comments
 (0)