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
|
update(detections)
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 |
Returns:
| Type | Description |
|---|---|
Detections
|
|
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.
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
|
update(detections)
Update tracker 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 |
Returns:
| Type | Description |
|---|---|
Detections
|
|
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
|
update(detections)
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 |
Returns:
| Type | Description |
|---|---|
Detections
|
|
reset()
Reset tracker state by clearing all tracks and resetting ID counter. Call this method when switching to a new video or scene.
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: