Skip to content

Reset CLEAR continuity after unmatched frames - #5237

Open
FlorianPfaff wants to merge 2 commits into
mainfrom
agent/reset-clear-continuity-after-gaps
Open

Reset CLEAR continuity after unmatched frames#5237
FlorianPfaff wants to merge 2 commits into
mainfrom
agent/reset-clear-continuity-after-gaps

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Owner

Bug

evaluate_clear(...) keeps two identity caches with different semantics:

  • previous_id tracks the last historical match for identity-switch counting;
  • previous_timestep_id should only represent matches from the immediately preceding frame for CLEAR continuity assignment.

The immediate-timestep cache was cleared after ordinary matched frames, but not when a frame had no ground-truth detections or no tracker detections. A match from two or more frames ago could therefore receive the +1000 continuity bonus after a gap and override the current similarity-optimal assignment.

In the regression sequence, two tracks are matched diagonally, missed for one frame, and then have stronger crossed similarities. Current main incorrectly preserves the stale diagonal assignment, reports zero identity switches, and accumulates motp_sum=3.2. The correct post-gap assignment is crossed, with two historical identity switches and motp_sum=3.8.

Fix

Clear previous_timestep_id before returning early from either empty-side frame branch. The historical previous_id cache remains unchanged, so identity switches after a gap are still counted correctly.

Regression coverage

Add test_clear_continuity_does_not_cross_unmatched_frames, which verifies:

  • four true positives, zero false positives, and two false negatives;
  • two identity switches after the gap;
  • similarity accumulation of 3.8, proving the post-gap Hungarian assignment follows current similarities rather than stale continuity.

Validation

  • independently reproduced the pre-fix result (tp, fp, fn, switches, motp_sum) = (4, 0, 2, 0, 3.2);
  • independently exercised the patched logic and obtained (4, 0, 2, 2, 3.8);
  • branch comparison: 2 commits ahead, 0 behind main;
  • final diff is limited to 2 production additions and a 20-line focused regression in the existing tracking-metrics test module.

GitHub Actions provides the authoritative full test, lint, packaging, documentation, and integration validation.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 24.09s
✅ JSON prettier 7 0 0 0 1.14s
✅ JSON v8r 7 0 0 4.12s
✅ MARKDOWN markdownlint 68 0 0 0 1.78s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.5s
✅ PYTHON black 1865 87 0 0 89.45s
✅ PYTHON isort 1865 139 0 0 2.74s
✅ REPOSITORY betterleaks yes no no 2.44s
✅ REPOSITORY checkov yes no no 46.5s
✅ REPOSITORY gitleaks yes no no 16.85s
✅ REPOSITORY git_diff yes no no 0.29s
✅ REPOSITORY secretlint yes no no 79.47s
✅ REPOSITORY syft yes no no 6.03s
✅ REPOSITORY trivy-sbom yes no no 4.83s
✅ REPOSITORY trufflehog yes no no 31.53s
✅ YAML prettier 11 0 0 0 0.69s
✅ YAML v8r 11 0 0 10.11s
✅ YAML yamllint 11 0 0 0.54s

Notices

📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining SECURITY_SUGGESTIONS: false)

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@9.6.0 --custom-flavor-setup --custom-flavor-linters PYTHON_BLACK,PYTHON_ISORT,COPYPASTE_JSCPD,JSON_V8R,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_GITLEAKS,REPOSITORY_BETTERLEAKS,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@FlorianPfaff
FlorianPfaff marked this pull request as ready for review August 7, 2026 17:59
@FlorianPfaff
FlorianPfaff enabled auto-merge (squash) August 7, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant