Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove save interpolated shapes #3658

Merged
merged 1 commit into from
Sep 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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