Getting Started
Install
Rust
[dependencies]
trackforge = "0.4"
The default build is light and pulls no image codecs. Every tracker runs on detections you pass in, and the appearance trackers run on embeddings you pass in. To have the library produce embeddings for you by running a model over a frame, enable the reid-model feature, which adds the AppearanceExtractor trait and the DeepSort and DeepOcSort wrappers along with the image crate.
[dependencies]
trackforge = { version = "0.3", features = ["reid-model"] }
Python
pip install trackforge
Your first tracker
The detection format is the same everywhere: a list of ([x, y, w, h], score, class_id) tuples,
where x, y is the top-left corner in pixels.
Rust
#![allow(unused)]
fn main() {
use trackforge::trackers::byte_track::ByteTrack;
let mut tracker = ByteTrack::new(0.5, 30, 0.8, 0.6);
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),
];
let tracks = tracker.update(detections);
for t in tracks {
println!("ID: {}, Box: {:?}", t.track_id, t.tlwh);
}
}
Python
from trackforge import BYTETRACK
tracker = BYTETRACK(track_thresh=0.5, track_buffer=30, match_thresh=0.8, det_thresh=0.6)
detections = [
([100.0, 100.0, 50.0, 100.0], 0.9, 0),
([200.0, 200.0, 60.0, 120.0], 0.85, 0),
]
for track_id, tlwh, score, class_id in tracker.update(detections):
print(f"ID: {track_id}, Box: {tlwh}")
Call update once per frame. Each tracker keeps its own state and returns the confirmed tracks
for the current frame.