trackforge / trackers / sort
Module sort
SORT: Simple Online and Realtime Tracking
This module implements the SORT (Simple Online and Realtime Tracking) algorithm.
Algorithm Overview
SORT is a simple yet effective multi-object tracking algorithm that combines: - Kalman Filtering for motion prediction - Hungarian Algorithm for data association using IoU (Intersection over Union)
Key Features
- Real-time performance: Designed for speed with minimal computational overhead
- No appearance features: Uses only bounding box information
- Simple track management: Tracks are created, confirmed, and deleted based on hit/miss counts
Parameters
| Parameter | Default | Description |
|---|---|---|
max_age |
1 | Maximum frames to keep a track without detection |
min_hits |
3 | Minimum consecutive hits before track is confirmed |
iou_threshold |
0.3 | Minimum IoU for matching detection to track |
References
Simple Online and Realtime Tracking Alex Bewley, Zongyuan Ge, Lionel Ott, Fabio Ramos, Ben Upcroft IEEE International Conference on Image Processing (ICIP), 2016 arXiv:1602.00763
Quick Reference
| Item | Kind | Description |
|---|---|---|
Sort |
struct | SORT (Simple Online and Realtime Tracking) tracker. |
SortTrack |
struct | A single track in SORT. |
SortTrackState |
enum | Track state enumeration for SORT. |
Types
Sort
SORT (Simple Online and Realtime Tracking) tracker.
Example
use trackforge::trackers::sort::Sort;
// Initialize tracker
let mut tracker = Sort::new(1, 3, 0.3);
// Simulated detections: (tlwh_box, score, class_id)
let detections = vec![
([100.0, 100.0, 50.0, 100.0], 0.9, 0),
([200.0, 200.0, 60.0, 120.0], 0.85, 0),
];
// Update tracker
let tracks = tracker.update(detections);
for track in tracks {
println!("Track ID: {}, Box: {:?}", track.track_id, track.tlwh);
}
Implementations
Create a new SORT tracker instance.
# Arguments
| Argument | Description |
|---|---|
max_age |
Maximum frames to keep a track without detection (default: 1). |
min_hits |
Minimum consecutive hits before track is confirmed (default: 3). |
iou_threshold |
Minimum IoU for matching detection to track (default: 0.3). |
Update the tracker with detections from the current frame.
# Arguments
| Argument | Description |
|---|---|
detections |
A vector of detections, where each detection is (TLWH_Box, Score, ClassID). |
# Returns
A vector of confirmed tracks.
Trait Implementations
impl<R> ReadPrimitive<R> for Sort
SortTrack
struct SortTrack {
pub tlwh: [f32; 4],
pub score: f32,
pub class_id: i64,
pub track_id: u64,
pub state: SortTrackState,
pub hits: usize,
pub time_since_update: usize,
pub age: usize,
// [REDACTED: Private Fields]
}
A single track in SORT.
Fields
| Name | Type | Description |
|---|---|---|
tlwh |
[f32; 4] |
Bounding box in TLWH (Top-Left-Width-Height) format. |
score |
f32 |
Detection confidence score. |
class_id |
i64 |
Class ID of the object. |
track_id |
u64 |
Unique track ID. |
state |
SortTrackState |
Current tracking state. |
hits |
usize |
Number of consecutive hits (matched detections). |
time_since_update |
usize |
Number of consecutive misses (no matched detection). |
age |
usize |
Total age of the track in frames. |
Implementations
Create a new track from a detection.
Predict the next state using Kalman filter.
Mark track as deleted.
Check if track should be confirmed based on min_hits.
Trait Implementations
SortTrackState
Track state enumeration for SORT.
Variants
Tentative
Track is tentative (not yet confirmed).
Confirmed
Track is confirmed and active.
Deleted
Track is deleted.
Trait Implementations