Skip to content

docs(io): state that MOT frame numbers start at 1 - #561

Open
AlexBodner wants to merge 5 commits into
developfrom
fix/mot-reader-validation
Open

AlexBodner wants to merge 5 commits into
developfrom
fix/mot-reader-validation

Conversation

@AlexBodner

@AlexBodner AlexBodner commented Aug 12, 2026 •

Copy link
Copy Markdown
Collaborator

States in the docs that MOT frame numbers start at 1. There are no code changes: load_mot_file still accepts lower frames, and evaluation still does not score them.

List of changes

  • load_mot_file docstring: adds that frame numbers start at 1 and that evaluation does not score lower frames.
  • evaluate_mot_sequence gt_path and tracker_path: adds that frame numbers start at 1.
  • File format section in docs/evaluations/evaluate.md: adds "Frame numbers start at 1 and rows with a lower frame number are not scored."

Testing

pre-commit and the doctests for both modules pass, along with tests/io and tests/eval.

🤖 Generated with Claude Code

Two ways MOT input was accepted and then silently produced wrong numbers.

`load_mot_file` took any parsable frame number. Every consumer walks
frames with `range(1, num_frames + 1)`, so rows on frame 0 or a negative
frame were loaded and then never evaluated, and `int(float(...))` quietly
truncated a fractional frame onto a different frame. Both are now
rejected, naming the file and the offending row. Frames written as floats
with no fractional part ("1.0") stay valid.

`evaluate_mot_sequence` scored ground truth that filtered down to nothing
as a clean run of zeros, which is indistinguishable from a tracker that
found nothing. It now raises, pointing at the ground-truth file.

The most common way to hit this is reusing tracker output as ground
truth: tracker files record class -1, and only pedestrian-class rows are
scored. The writer is left alone, since TrackEval tracker files carry no
class either — the error explains the mismatch instead.

The guard lives in `evaluate_mot_sequence` rather than
`_prepare_mot_sequence` because an individual all-distractor frame is
legitimate, and existing tests pin that primitive's TrackEval-mirroring
behavior of returning zero scored rows.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Borda
Borda requested a balanced review from Copilot August 12, 2026 18:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Strengthens MOT evaluation input validation to prevent silently incorrect metrics.

Changes:

  • Rejects non-positive and fractional frame numbers.
  • Rejects ground truth with no scorable pedestrian rows and adds regression tests.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/trackers/io/mot.py Validates frame numbers.
src/trackers/eval/evaluate.py Rejects unscorable ground truth.
tests/io/test_mot.py Tests frame validation.
tests/eval/test_evaluate.py Tests ground-truth filtering errors.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/trackers/io/mot.py Outdated
Comment on lines +211 to +218
frame_number = float(row[0])
except ValueError as e:
raise ValueError(f"Invalid frame number in {path}: {row[0]}") from e

# Consumers walk frames with `range(1, num_frames + 1)`, so anything outside that
# domain would be loaded here and then silently never evaluated.
if not frame_number.is_integer():
raise ValueError(f"Frame numbers must be whole numbers in {path}, got {row[0]} in row: {row}")
@Borda

Borda commented Oct 6, 2026

Copy link
Copy Markdown
Member

@AlexBodner, shall we finish it and merge it, or close it? 🤔

@AlexBodner AlexBodner changed the title fix(io): reject unusable frame numbers and unscorable ground truth docs(io): state that MOT frame numbers start at 1 Nov 2, 2026
AlexBodner and others added 4 commits November 2, 2026 10:51
Drop the frame-number and unscored ground-truth checks: the library only
writes frames from 1, so this is part of the input contract.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AlexBodner
AlexBodner marked this pull request as ready for review November 2, 2026 14:14
@AlexBodner

Copy link
Copy Markdown
Collaborator Author

Ready to merge, I converted it into a docs clarification

@AlexBodner
AlexBodner requested a review from Borda November 2, 2026 14:19
@AlexBodner AlexBodner added the documentation Improvements or additions to documentation label Nov 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants