Skip to content

Commit

Permalink
Fix the converted YOLO format polygon by appending the first point to…
Browse files Browse the repository at this point in the history
… the end
  • Loading branch information
healthonrails committed Dec 3, 2024
1 parent db0e7ce commit b831c18
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions annolid/annotation/labelme2yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ def scale_points(self, labelme_shape, image_height, image_width):
points[1::2] = [float(point[1]) / image_height for point in point_list]
if len(points) == 4:
points = point_list_to_numpy_array(points)
# Close the polygon by appending the first point to the end
points = np.append(points, [points[0], points[1]])
# Map the label of the shape to a label_id
label_id = self.label_to_id_dict[labelme_shape['label']]
# Return the label_id and points as a list
Expand Down

0 comments on commit b831c18

Please sign in to comment.