diff --git a/annolid/annotation/labelme2csv.py b/annolid/annotation/labelme2csv.py index d564404..3977ac8 100644 --- a/annolid/annotation/labelme2csv.py +++ b/annolid/annotation/labelme2csv.py @@ -88,7 +88,7 @@ def convert_json_to_csv(json_folder, csv_file=None): class_score = 1.0 if len(bboxs) > 0: - cy, cx = polygon_center(points) + cx, cy = polygon_center(points) x1, y1, x2, y2 = bboxs[0] csv_writer.writerow( [frame_number, x1, y1, x2, y2, cx, cy, diff --git a/annolid/postprocessing/glitter.py b/annolid/postprocessing/glitter.py index 98e9367..c4c9926 100644 --- a/annolid/postprocessing/glitter.py +++ b/annolid/postprocessing/glitter.py @@ -403,9 +403,9 @@ def left_right_interact(fn, is_draw = is_draw # and (left_interact > 0 or right_interact > 0) if not math.isnan(x1) and _frame_num == frame_number: - cx = int((x1 + x2) / 2) + cx = int((x1 + x2) / 2) if 'cx' not in bf else int(bf['cx']) cy_glitter = int((glitter_y1 + glitter_y2) / 2) - cy = int((y1 + y2) / 2) + cy = int((y1 + y2) / 2) if 'cy' not in bf else int(bf['cy']) _, color = draw.get_label_color( _class) @@ -510,7 +510,7 @@ def left_right_interact(fn, color, -1) if _class in animal_names and 'zone' not in _class.lower(): - mask_label = f"-{_class}{tracking_id}-{score*100:.2f}%" if len( + mask_label = f"-{_class}{tracking_id if tracking_id != 0 else ''}" if len( bbox_info) < 10 else str(tracking_id) cv2.putText(frame, mask_label, (cx+3, cy+3), cv2.FONT_HERSHEY_SIMPLEX,