Skip to content

Commit

Permalink
Slightly improve code for annotation.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita Manovich committed Apr 17, 2019
1 parent 2d01d35 commit a01555e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cvat/apps/engine/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,9 +845,9 @@ def merge(self, objects, start_frame, overlap):

# Nothing to merge here. Just add all int_objects if any.
if not old_objects_by_frame or not int_objects_by_frame:
for old_obj in [item for sublist in old_objects_by_frame.values() for item in sublist]:
self._modify_unmached_object(old_obj,
start_frame + overlap)
for frame in old_objects_by_frame:
for old_obj in old_objects_by_frame[frame]:
self._modify_unmached_object(old_obj, start_frame + overlap)
self.objects.extend(int_objects)
return

Expand Down Expand Up @@ -952,7 +952,7 @@ def _calc_polygons_similarity(p0, p1):
return overlap_area / (p0.area + p1.area - overlap_area)

has_same_type = obj0["type"] == obj1["type"]
has_same_label = obj0["label_id"] == obj1["label_id"] if "label_id" in obj0 else True
has_same_label = obj0.get("label_id") == obj1.get("label_id")
if has_same_type and has_same_label:
if obj0["type"] == models.ShapeType.RECTANGLE:
p0 = geometry.box(*obj0["points"])
Expand Down

0 comments on commit a01555e

Please sign in to comment.