Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
Do not create last job shorter than overlap size
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhail-treskin committed Oct 25, 2023
1 parent c19ea38 commit c9f41ea
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cvat/apps/engine/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,14 @@ def _segments():

segment_step -= overlap

segments = (
segments = [
SegmentParams(start_frame, min(start_frame + segment_size - 1, data_size - 1))
for start_frame in range(0, data_size, segment_step)
)
]
if segments[-1].stop_frame - segments[-1].start_frame <= overlap:
segments.pop(-1)

return SegmentsParams(segments, segment_size, overlap)
return SegmentsParams(iter(segments), segment_size, overlap)

def _save_task_to_db(db_task: models.Task, *, job_file_mapping: Optional[JobFileMapping] = None):
job = rq.get_current_job()
Expand Down

0 comments on commit c9f41ea

Please sign in to comment.