Feat/core/refactor tracklet kalman filter#310
Merged
Conversation
…w/trackers into feat/core/ocsort-release
…w/trackers into feat/core/ocsort-release
…d update also when unmatched detections = 0
…lets - [resolve #3] Review comment by @Copilot (PR #310): "detections.confidence can be None (sv.Detections allows optional confidence). _spawn_new_tracklets assumes confidences is an array and indexes into it, which will raise if confidence is missing." --- Co-authored-by: Claude Code <noreply@anthropic.com> Co-authored-by: OpenAI Codex <codex@openai.com>
…ecated trackers alias - [resolve #4] /review finding by foundry:sw-engineer (report: .temp/output-review-sort-tracker-update-fresh-2026-04-24-2.md): "Three names (tracks/trackers/tracklets) for one list is confusing and fragile. Use self.tracks as canonical attribute, add @Property trackers as deprecated alias." - Remove tracks property/setter and tracklets internal attribute - Make tracks a plain instance attribute in __init__ - Keep @Property trackers as read-only deprecated alias (pyDeprecate) - Update test_associated_indices to use tracker.tracks --- Co-authored-by: Claude Code <noreply@anthropic.com> Co-authored-by: OpenAI Codex <codex@openai.com>
…reates independent copy) - [resolve #18] /review finding by foundry:sw-engineer (report: .temp/output-review-sort-tracker-update-fresh-2026-04-24-2.md): "deepcopy added only to OC-SORT not ByteTrack — inconsistency; supervision fancy indexing already copies" - Remove deepcopy after slicing detections; slice result is already independent - Remove unused `from copy import deepcopy` import --- Co-authored-by: Claude Code <noreply@anthropic.com> Co-authored-by: OpenAI Codex <codex@openai.com>
…ment] - [resolve #17] /review finding by foundry:linting-expert (report: .temp/output-review-sort-tracker-update-fresh-2026-04-24-2.md): "type: ignore[assignment] on alive-tracklet calls — variance issue; return type should use TypeVar" - Add T_SORTTracklet TypeVar in sort/utils.py and T_ByteTrackTracklet in bytetrack/utils.py - Remove # type: ignore[assignment] from both tracker files --- Co-authored-by: Claude Code <noreply@anthropic.com> Co-authored-by: OpenAI Codex <codex@openai.com>
…new tracklet tests - [resolve #7] Add shape validation to set_kf_covariances (R/Q/P checked against dim_z/dim_x) - [resolve #16] Document that state estimators require external noise config via set_kf_covariances - [resolve #15] Document maturity attr difference: SORT uses total updates, ByteTrack uses consecutive - [resolve #19] Add test/core/test_tracklets.py: SORTTracklet, ByteTrackTracklet, BaseTracklet unit tests - [resolve #20] Clarify state-estimators.md: XYXYStateEstimator is new configurable default, not historical --- Co-authored-by: Claude Code <noreply@anthropic.com> Co-authored-by: OpenAI Codex <codex@openai.com>
--- Co-authored-by: Claude Code <noreply@anthropic.com>
Borda
reviewed
Apr 24, 2026
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
…d not in predict, introduced in 8987ead, but break MOTA
…ithub.com/roboflow/trackers into feat/core/refactor-tracklet-kalman-filter
…ithub.com/roboflow/trackers into feat/core/refactor-tracklet-kalman-filter
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.
What does this PR do?
Refactors KalmanBoxTracker to Tracklet classes so decouples Kalman Filter logic from the tracklet, also creating a unique Kalman Filter that will be used by all the algorithms based on the OC-SORT paper implementation of the KF. This also supports swappable kalman filter state coordinates, using the abstraction StateEstimator.
Beware that:
OC-SORT and SORT metrics remain the same BUT ByteTrack ones has small changes (at least with default parameters) because it now uses the same kalman filter as OC-SORT (which has slight differences in implementation that make it better in OC-SORT) but here it drops 0.1%. Initialization for bytetrack remains the same as we now support custom initializations per tracker.
ByteTrack has a behaviour difference wrt other trackers, to match original it initializes tracklets number_of_successful_consecutive_updates to 1, while in the other ones it is initalized to 0. Also, before this PR our ByteTrack used number_of_updates, instead of counting consecutive updates. Changing this gives different performance (+0.4% HOTA DanceTrack and -0.07% SportMOT reported in test cases and throwing the error). I think this change makes sense for the tracker, so we might have to consider redoing the parameter tuning to have results again with this change or roll this back to keep the same behaviour as the previous version of bytetrack.
Type of Change
SNMOT-118-single-track-xyxy-vs-xcycsr.mp4
closes #359