Skip to content

Commit

Permalink
Remove save interpolated shapes (#3658)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill Sizov authored Sep 9, 2021
1 parent c60e8aa commit 31f6234
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions cvat/apps/dataset_manager/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ def filter_track_shapes(shapes):
interpolated_shapes[stop + 1]['outside']:
segment_shapes.append(interpolated_shapes[stop + 1])

# Should delete 'interpolation_shapes' and 'keyframe' keys because
# Track and TrackedShape models don't expect these fields
del track['interpolated_shapes']
for shape in segment_shapes:
shape.pop('keyframe', None)

Expand Down Expand Up @@ -429,15 +426,6 @@ def _modify_unmached_object(obj, end_frame):
shape["frame"] = end_frame
shape["outside"] = True
obj["shapes"].append(shape)
# Need to update cached interpolated shapes
# because key shapes were changed
if obj.get("interpolated_shapes"):
last_interpolated_shape = obj["interpolated_shapes"][-1]
for frame in range(last_interpolated_shape["frame"] + 1, end_frame):
last_interpolated_shape = deepcopy(last_interpolated_shape)
last_interpolated_shape["frame"] = frame
obj["interpolated_shapes"].append(last_interpolated_shape)
obj["interpolated_shapes"].append(shape)

@staticmethod
def get_interpolated_shapes(track, start_frame, end_frame):
Expand Down Expand Up @@ -713,9 +701,6 @@ def interpolate(shape0, shape1):

return shapes

if track.get("interpolated_shapes"):
return track["interpolated_shapes"]

shapes = []
curr_frame = track["shapes"][0]["frame"]
prev_shape = {}
Expand All @@ -742,8 +727,6 @@ def interpolate(shape0, shape1):
shape["frame"] = end_frame
shapes.extend(interpolate(prev_shape, shape))

track["interpolated_shapes"] = shapes

return shapes

@staticmethod
Expand All @@ -760,6 +743,5 @@ def _unite_objects(obj0, obj1):

track["frame"] = min(obj0["frame"], obj1["frame"])
track["shapes"] = list(sorted(shapes.values(), key=lambda shape: shape["frame"]))
track["interpolated_shapes"] = []

return track

0 comments on commit 31f6234

Please sign in to comment.