Repository navigation
fix(smoother): count repeated track IDs once per frame - #3035
Open
Nikhila-Dhevi-R wants to merge 3 commits into
Open
Nikhila-Dhevi-R wants to merge 3 commits into
Nikhila-Dhevi-R wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟢 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
DetectionsSmootheradds 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