Skip to content

Commit

Permalink
Fix stop_frame
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiltsov-max committed Jun 9, 2023
1 parent 8a4ed6c commit f80fbe0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cvat/apps/engine/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ def create(self, validated_data):

segment = models.Segment.objects.create(
start_frame=0,
stop_frame=task.data.size,
stop_frame=task.data.size - 1,
frames=frames,
task=task,
type=models.SegmentType.SPECIFIC_FRAMES,
Expand Down
8 changes: 8 additions & 0 deletions tests/python/rest_api/test_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,10 @@ def test_can_get_gt_job_meta(self, admin_user, tasks, task_mode):
with make_api_client(user) as api_client:
(gt_job_meta, _) = api_client.jobs_api.retrieve_data_meta(gt_job.id)

# These values are relative to the resulting task frames, unlike meta values
assert 0 == gt_job.start_frame
assert task_meta.size - 1 == gt_job.stop_frame

# The size is adjusted by the frame step and included frames
assert job_frame_count == gt_job_meta.size
assert job_frame_ids == gt_job_meta.included_frames
Expand Down Expand Up @@ -623,6 +627,10 @@ def test_can_get_gt_job_meta_with_complex_frame_setup(self, admin_user):
with make_api_client(admin_user) as api_client:
(gt_job_meta, _) = api_client.jobs_api.retrieve_data_meta(gt_job.id)

# These values are relative to the resulting task frames, unlike meta values
assert 0 == gt_job.start_frame
assert len(task_frame_ids) - 1 == gt_job.stop_frame

# The size is adjusted by the frame step and included frames
assert len(job_frame_ids) == gt_job_meta.size
assert job_frame_ids == gt_job_meta.included_frames
Expand Down

0 comments on commit f80fbe0

Please sign in to comment.