Skip to content

fix(smoother): count repeated track IDs once per frame - #3035

Open
Nikhila-Dhevi-R wants to merge 3 commits into
roboflow:developfrom
Nikhila-Dhevi-R:codex/smoother-duplicate-track-frames
Open

Nikhila-Dhevi-R wants to merge 3 commits into
roboflow:developfrom
Nikhila-Dhevi-R:codex/smoother-duplicate-track-frames

Conversation

@Nikhila-Dhevi-R

Copy link
Copy Markdown

Description

DetectionsSmoother adds every occurrence of a confirmed tracker ID to its history, even when several detections with that ID arrive in the same frame. With a two-frame window, a repeated ID can evict the previous frame and distort the smoothed box and confidence.

Use the first confirmed detection for each ID in a frame, consistent with PolygonZone's first-occurrence policy. Negative IDs remain unsmoothed and each detection is retained.

Testing

  • Regression tests fail on the base and pass with the fix, covering the history window, confidence, distinct confirmed IDs and repeated negative IDs.

  • pytest -q --cov=supervision --tb=short: 7,580 passed, 283 skipped. Unmodified baseline: 7,578 passed, 283 skipped.

  • pre-commit run --all-files: passed.

  • Added/updated tests, and the full suite passes locally

  • Updated the method documentation and changelog

@Borda
Borda requested a balanced review from Copilot November 20, 2026 21:29
@Borda Borda added the bug Something isn't working label Nov 20, 2026

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.

🟢 Approval recommended

There are no active review issues for the change to prevent duplicate confirmed tracker IDs from skewing smoothing history.

No open issues 🎉

What changed in this PR

This PR fixes DetectionsSmoother so repeated confirmed tracker IDs in one frame cannot consume multiple history slots and distort smoothed results.

Changes:

  • Use only the first detection per confirmed tracker ID in each frame, while preserving all negative-ID detections unchanged.
  • Add regression tests for history weighting, confidence, distinct tracks, and repeated negative IDs.
  • Document the first-occurrence behavior in the method docstring and changelog.
File Description
tests/​detection/​tools/​test_smoother.py Adds regression coverage for repeated confirmed and negative tracker IDs.
src/​supervision/​detection/​tools/​smoother.py Deduplicates confirmed IDs before updating history and documents the behavior.
docs/​changelog.md Records the smoothing fix and links its PR.

Review effort: Balanced

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

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants