Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Examples

Runnable demos live under examples/ in the repository, with a Python and a Rust entry per tracker.

TrackerPythonRust
ByteTrackbyte_track_demo.pybyte_track_demo.rs
DeepSORTdeepsort_demo.pydeepsort_simple.rs, deepsort_ort.rs
OC-SORTocsort_demo.py-
Deep OC-SORTdeep_ocsort_demo.py-
BoT-SORTbotsort_demo.pydet_ind_demo.rs
SORTsort_yolo_demo.py, sort_rtdetr_demo.py-
TrackTracktracktrack_demo.pytracktrack_demo.rs
# Python
python examples/python/byte_track_demo.py

# Rust
cargo run --example byte_track_demo
cargo run --example deepsort_simple --features reid-model
cargo run --example deepsort_ort --features advanced_examples
cargo run --example det_ind_demo
cargo run --example tracktrack_demo

The Python demos use the usual detector stacks (ultralytics, transformers + torch, torch + torchvision); install what a given demo imports. The deepsort_simple Rust demo needs the reid-model feature and the deepsort_ort demo needs the advanced_examples feature (ONNX Runtime + OpenCV).

Ultralytics

Python: trackforge.track_ultralytics(model, source, tracker) runs an Ultralytics model over a video, webcam, stream or image folder and yields (result, tracks) per frame, and trackforge.from_ultralytics(result) converts a single result for your own loop. See ultralytics_track.py.

for result, tracks in trackforge.track_ultralytics(YOLO("yolo11n.pt"), "people.mp4", trackforge.BYTETRACK(), classes=[0]):
    print(len(tracks))

Rust: trackforge::utils::detections_from_xyxy turns the [x1, y1, x2, y2, conf, cls] box data of ultralytics-inference boxes into tracker input. The examples/ultralytics crate tracks a video or image folder with any motion tracker. It is a separate crate because ultralytics-inference is AGPL-3.0.

cd examples/ultralytics
cargo run --release -- "frames/*.jpg" --tracker bytetrack --classes 0
cargo run --release --features video -- people.mp4 --classes 0 --save tracked.mp4