Skip to content

Commit

Permalink
Fix keyframe removing (#6494)
Browse files Browse the repository at this point in the history
Steps to reproduce this bug:

Create a track that starts on the frame i and has keyframe on the frame j (i < j)
Save
Remove the keyframe for the created track on the frame i
Save
  • Loading branch information
Kirill Sizov authored Jul 24, 2023
1 parent 2896bec commit 6e5ac4b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed SAM plugin (403 code for workers in organizations) (<https://github.com/opencv/cvat/pull/6514>)
- Using initial frame from query parameter to open specific frame in a job
(<https://github.com/opencv/cvat/pull/6506>)
- Problem with first keyframe removing (<https://github.com/opencv/cvat/pull/6494>)
- Server-side validation for attribute specifications
(<https://github.com/opencv/cvat/pull/6447>)
- \[API\] File downloading failures for filenames with special characters l(<https://github.com/opencv/cvat/pull/6492>)
Expand Down
1 change: 1 addition & 0 deletions cvat/apps/dataset_manager/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def _add_missing_shape(self, track, first_shape):
missing_shape = deepcopy(first_shape)
missing_shape["frame"] = track["frame"]
missing_shape["outside"] = True
missing_shape.pop("id")
track["shapes"].append(missing_shape)

def _correct_frame_of_tracked_shapes(self, track):
Expand Down
16 changes: 16 additions & 0 deletions tests/python/rest_api/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,22 @@ def test_member_update_task_annotation(

self._test_check_response(is_allow, response, data)

def test_remove_first_keyframe(self):
endpoint = "tasks/8/annotations"
shapes0 = [
{"type": "rectangle", "frame": 1, "points": [1, 2, 3, 4]},
{"type": "rectangle", "frame": 4, "points": [5, 6, 7, 8]},
]

annotations = {"tracks": [{"label_id": 13, "frame": 0, "shapes": shapes0}]}

response = patch_method("admin1", endpoint, annotations, action="create")
assert response.status_code == HTTPStatus.OK, response.content

annotations["tracks"][0]["shapes"] = shapes0[1:]
response = patch_method("admin1", endpoint, annotations, action="update")
assert response.status_code == HTTPStatus.OK


@pytest.mark.usefixtures("restore_db_per_class")
class TestGetTaskDataset:
Expand Down

0 comments on commit 6e5ac4b

Please sign in to comment.