Trackers API
SORT
trackers.core.sort.tracker.SORTTracker
Bases: BaseTracker
In SORT, object tracking begins with high-confidence detections fed into a Kalman filter framework assuming uniform motion for state prediction across frames. Association occurs via IoU-based costs in the Hungarian algorithm, enforcing a threshold to filter weak matches and initialize new identities. Tracks persist only with consistent associations, terminating quickly to avoid erroneous propagation. This detection-driven approach underscores the importance of upstream detector performance in achieving competitive multi-object tracking results. Over time, SORT has become a cornerstone for evaluating motion-based improvements in the field.
SORT's standout strength is its real-time capability, processing hundreds of frames per second while maintaining accuracy comparable to more complex offline methods. It performs well in controlled environments with reliable detections, minimizing computational demands. However, without mechanisms for re-identification, it incurs frequent identity switches during object reappearances post-occlusion. The linear motion assumption limits effectiveness in non-linear paths, such as those in sports or wildlife tracking. Ultimately, SORT's efficiency is offset by its sensitivity to environmental complexities, necessitating hybrid extensions for broader applicability.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lost_track_buffer
|
int
|
|
30
|
frame_rate
|
float
|
|
30.0
|
track_activation_threshold
|
float
|
|
0.25
|
minimum_consecutive_frames
|
int
|
|
3
|
minimum_iou_threshold
|
float
|
|
0.3
|
state_estimator_class
|
type[BaseStateEstimator]
|
State estimator class to use for Kalman filter.
|
XYXYStateEstimator
|
iou
|
BaseIoU | None
|
IoU similarity metric instance to use for data association.
Defaults to standard |
None
|
trackers
property
Deprecated alias for :attr:tracks.
.. deprecated:: 2.5
Use :attr:tracks instead. Will be removed in v3.0.
update(detections, frame=None)
Update tracker state with new detections and return tracked objects. Performs Kalman filter prediction, IoU-based association, and initializes new tracks for unmatched high-confidence detections.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
detections
|
Detections
|
|
required |
frame
|
ndarray | None
|
Ignored by SORT. If provided (not |
None
|
Returns:
| Type | Description |
|---|---|
Detections
|
sv.Detections with tracker_id assigned for each detection. |
Detections
|
Unmatched or immature tracks have tracker_id of -1. |
reset()
Reset tracker state by clearing all tracks and resetting ID counter. Call this method when switching to a new video or scene.
ByteTrack
trackers.core.bytetrack.tracker.ByteTrackTracker
Bases: BaseTracker
ByteTrack operates online by processing all detector outputs, categorizing them by confidence thresholds to enable a two-stage association process. High-score boxes are initially linked to tracklets via Kalman filter predictions and IoU-based Hungarian matching, optionally enhanced with appearance features. Low-score boxes follow in a secondary matching phase using pure motion similarity to revive occluded tracks. Tracks without matches are kept briefly for potential re-association, preventing premature termination. This inclusive approach addresses common pitfalls in detection filtering, establishing ByteTrack as a flexible enhancer for existing tracking frameworks.
ByteTrack excels in dense environments, where its low-score recovery mechanism minimizes missed detections and enhances overall trajectory completeness. It consistently improves performance across diverse datasets, demonstrating robustness and generalization. The tracker's speed remains competitive, facilitating integration into production pipelines. On the downside, it is highly dependent on detector quality, with performance drops in noisy or low-resolution inputs. Additionally, the motion-only secondary association may lead to erroneous matches in scenes with similar moving objects.
Note
When input detections carry no confidence (detections.confidence is
None), ByteTrack falls back to a single-stage IoU match equivalent to
SORT — every detection is treated as fully confident, so the
low-confidence recovery stage is bypassed. Pass per-detection
confidences to exercise the two-stage matching this class otherwise
provides.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lost_track_buffer
|
int
|
|
30
|
frame_rate
|
float
|
|
30.0
|
track_activation_threshold
|
float
|
|
0.7
|
minimum_consecutive_frames
|
int
|
|
2
|
minimum_iou_threshold
|
float
|
|
0.1
|
high_conf_det_threshold
|
float
|
|
0.6
|
state_estimator_class
|
type[BaseStateEstimator]
|
State estimator class to use for Kalman filter.
Defaults to |
XYXYStateEstimator
|
iou
|
BaseIoU | None
|
IoU similarity metric instance to use for data association.
Defaults to standard |
None
|
update(detections, frame=None)
Update tracks state with new detections and return tracked objects. Performs Kalman filter prediction, two-stage association (high then low confidence), and initializes new tracks for unmatched detections.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
detections
|
Detections
|
|
required |
frame
|
ndarray | None
|
Ignored by ByteTrack. If provided (not |
None
|
Returns:
| Type | Description |
|---|---|
Detections
|
sv.Detections with tracker_id assigned for each detection. |
Detections
|
Unmatched detections have tracker_id of -1. Detection order may |
Detections
|
differ from input. |
reset()
Reset tracker state by clearing all tracks and resetting ID counter. Call this method when switching to a new video or scene.
OC-SORT
trackers.core.ocsort.tracker.OCSORTTracker
Bases: BaseTracker
OC-SORT enhances traditional SORT by shifting to an observation-centric paradigm, using detections to correct Kalman filter errors accumulated during occlusions. It introduces Observation-Centric Re-Update to generate virtual trajectories for parameter refinement upon track reactivation. Association incorporates Observation-Centric Momentum, blending IoU with direction consistency from historical observations. Short-term recoveries are aided by heuristics linking unmatched tracks to prior detections. This rethinking prioritizes real measurements over estimations, making OC-SORT particularly adept at handling real-world tracking challenges.
OC-SORT's primary strength is its robustness to non-linear motions and occlusions, outperforming baselines on datasets with erratic movements like DanceTrack. It maintains extreme efficiency, processing over 700 frames per second on CPUs for scalable deployments. The tracker excels in crowded scenes, reducing identity switches through momentum-based associations. However, lacking appearance features, it can confuse similar objects in overlapping paths. Its linear motion core still imposes limits in extreme velocity variations, requiring careful parameter selection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lost_track_buffer
|
int
|
|
30
|
frame_rate
|
float
|
|
30.0
|
minimum_consecutive_frames
|
int
|
|
3
|
minimum_iou_threshold
|
float
|
|
0.3
|
direction_consistency_weight
|
float
|
|
0.2
|
high_conf_det_threshold
|
float
|
|
0.6
|
delta_t
|
int
|
|
3
|
state_estimator_class
|
type[BaseStateEstimator]
|
State estimator class to use for Kalman filter.
Defaults to |
XCYCSRStateEstimator
|
iou
|
BaseIoU | None
|
IoU similarity metric instance to use for data association.
Defaults to standard |
None
|
update(detections, frame=None)
Update tracker state with new detections and return tracked objects. Performs Kalman filter prediction, two-stage association using direction consistency and last-observation recovery, and initializes new tracks for unmatched high-confidence detections.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
detections
|
Detections
|
|
required |
frame
|
ndarray | None
|
Ignored by OC-SORT. If provided (not |
None
|
Returns:
| Type | Description |
|---|---|
Detections
|
sv.Detections with tracker_id assigned for each detection. |
Detections
|
Unmatched or immature tracks have tracker_id of -1. |
reset()
Reset tracker state by clearing all tracks and resetting ID counter. Call this method when switching to a new video or scene.
BoT-SORT
trackers.core.botsort.tracker.BoTSORTTracker
Bases: BaseTracker
BoT-SORT-style multi-object tracker (IoU association + optional CMC).
The tracker maintains a list of active tracks (Kalman-filter-based) and, for each frame, performs: 1) Predict existing track states (Kalman predict) 2) Split detections into high/low confidence groups 3) Split tracks into confirmed, unconfirmed, and lost 4) Apply camera motion compensation to predicted tracks 5) Associate high-confidence detections to confirmed + lost tracks (IoU fused with detection scores + assignment) 6) Associate low-confidence detections to remaining tracks (excluding lost tracks) 7) Match remaining unmatched high-confidence detections to unconfirmed tracks and remove unmatched unconfirmed tracks 8) Spawn new tracks from still unmatched high-confidence detections (instantly activated on the very first frame) 9) Remove tracks that have been lost for too long
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lost_track_buffer
|
int
|
Time buffer (in frames at 30 FPS) for keeping lost tracks
alive before deletion. This is scaled by |
30
|
frame_rate
|
float
|
Video frame rate used to scale the lost track buffer to time-like behavior. |
30.0
|
track_activation_threshold
|
float
|
Minimum detection confidence to spawn a new track. |
0.7
|
minimum_consecutive_frames
|
int
|
Number of successful updates required before assigning a stable track ID (different than initial -1). |
2
|
minimum_iou_threshold_first_assoc
|
float
|
Minimum fused similarity (IoU x detection confidence) to accept a detection-track association during the first association step. |
0.2
|
minimum_iou_threshold_second_assoc
|
float
|
Minimum fused similarity (IoU x detection confidence) to accept a detection-track association during the second association step. |
0.5
|
minimum_iou_threshold_unconfirmed_assoc
|
float
|
Minimum fused similarity (IoU x score) to accept a match between an unconfirmed track and a remaining high-confidence detection. Corresponds to the original ByteTrack's hardcoded cost threshold of 0.7 (= similarity 0.3). |
0.3
|
high_conf_det_threshold
|
float
|
Confidence threshold used to split detections into: - high confidence: confidence >= threshold - low confidence: confidence < threshold |
0.6
|
enable_cmc
|
bool
|
Whether to enable camera motion compensation (CMC). |
True
|
cmc_method
|
CMCMethod
|
CMC method string passed into |
'sparseOptFlow'
|
cmc_downscale
|
int
|
Downscale factor used inside CMC for speed/robustness. |
2
|
instant_first_frame_activation
|
bool
|
If |
True
|
state_estimator_class
|
type[BaseStateEstimator]
|
State estimator class for tracklets. Defaults
to |
XCYCWHStateEstimator
|
iou
|
BaseIoU | None
|
IoU similarity metric instance to use for data association.
Defaults to standard |
None
|
Notes
maximum_frames_without_updateis computed as: int(frame_rate / 30.0 * lost_track_buffer) to maintain consistent “seconds” worth of buffer across different FPS.- When CMC is enabled, pass the current video frame via the
frameargument of :meth:update.
update(detections, frame=None)
Update the tracker with detections from the current frame.
This is the main per-frame entry point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
detections
|
Detections
|
Supervision detections for the current frame. Must include
|
required |
Returns:
| Type | Description |
|---|---|
Detections
|
New sv.Detections with tracker_id assigned for each detection. |
Detections
|
Confirmed tracks have tracker_id >= 0; unconfirmed tracks have |
Detections
|
tracker_id of -1. |
Notes
- If CMC is enabled, pass the current video frame via
frameso the tracker can estimate a global affine transform and warp predicted track states before association.
reset()
Reset tracker state by clearing all tracks and resetting ID counter. Call this method when switching to a new video or scene.
apply_cmc_batch(H)
Apply CMC to all active tracks.
.. deprecated:: 2.5 Use CMC.apply_batch(H, self.tracks) directly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
H
|
ndarray | None
|
2x3 affine transform matrix returned by CMC.estimate(). If None, this method is a no-op. |
required |
Examples:
Utilities
trackers.utils.converters.xyxy_to_xcycsr(xyxy)
Convert bounding boxes from corner to center-scale-ratio format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xyxy
|
ndarray
|
Bounding boxes |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Bounding boxes |
Examples:
trackers.utils.converters.xcycsr_to_xyxy(xcycsr)
Convert bounding boxes from center-scale-ratio to corner format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xcycsr
|
ndarray
|
Bounding boxes |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Bounding boxes |
Examples: