Trackforge is a unified, high-performance computer vision tracking library implemented in Rust with Python bindings. It provides real-time multi-object tracking algorithms, optimized for speed and designed as the CPU "glue" between GPU-based object detectors and your tracking pipeline.
Supported Trackers
| Tracker | Type | Appearance (Re-ID) |
|---|---|---|
| ByteTrack | IoU + confidence association | No |
| DeepSORT | IoU + cosine distance | Yes (pluggable) |
| OC-SORT | IoU + velocity direction (OCM) | No |
| SORT | IoU + Kalman filter | No |
Features
- 🚀 Native Rust Core Blazingly fast tracking (< 1ms/frame for ByteTrack) with full memory safety
- 🐍 Python Bindings First-class
pip install trackforgesupport via PyO3 - 🎯 Multi-Algorithm ByteTrack, OC-SORT, DeepSORT, and SORT with a unified API
- 🔌 Pluggable Re-ID DeepSORT's appearance extractor is a trait; plug in any feature model
- 📐 Generic Kalman Filter Configurable position/velocity weighting, gating distance computation
[!IMPORTANT] Under active development. APIs and features are subject to change. MSRV: Rust 1.89.
Installation
Python
Rust
Add to your Cargo.toml:
[]
= "0.3.0"
To build the Python bindings from source (e.g. via maturin develop), enable the python feature:
[]
= { = "0.3.0", = ["python"] }
Quick Start
Python - ByteTrack
=
# Format: ([x, y, w, h], confidence, class_id)
=
=
Python - DeepSORT
=
=
= # appearance feature vectors
=
Python - OC-SORT
=
=
=
Rust - ByteTrack
use ByteTrack;
let mut tracker = new;
// Format: ([x, y, w, h], confidence, class_id)
let detections = vec!;
let tracks = tracker.update;
for t in tracks
Rust - DeepSORT
use DeepSort;
// `extractor` implements the AppearanceExtractor trait (plug in any Re-ID model).
let mut tracker = new;
let detections = vec!;
let tracks = tracker.update?;
for t in tracks
Rust - OC-SORT
use OcSort;
let mut tracker = new;
let detections = vec!;
let tracks = tracker.update;
for t in tracks
Rust - SORT
use Sort;
let mut tracker = new;
let detections = vec!;
let tracks = tracker.update;
for t in tracks
Examples
Runnable demos live under examples/, with both a Python and a Rust entry per tracker.
| Tracker | Python | Rust |
|---|---|---|
| ByteTrack | byte_track_demo.py (YOLO11) |
byte_track_demo.rs |
| DeepSORT | deepsort_demo.py (YOLO + ResNet18) |
deepsort_simple.rs, deepsort_ort.rs (ONNX) |
| OC-SORT | ocsort_demo.py |
— |
| SORT | sort_yolo_demo.py (YOLO), sort_rtdetr_demo.py (RT-DETR) |
— |
| All four | tracker_comparison.py side-by-side benchmark |
— |
# Python
# Rust
The Python demos use the usual detector stacks: ultralytics (YOLO), transformers + torch
(RT-DETR), and torch + torchvision (ResNet Re-ID); install what a given demo imports. The
deepsort_ort Rust demo needs the advanced_examples feature (ONNX Runtime + OpenCV).
API Reference
Parameters
Each tracker's parameters and defaults (identical across Python and Rust) are documented on the Parameters page.
Development
Prerequisites
- Rust 1.89+ (MSRV)
- Python 3.8+ and
maturinfor the bindings prekfor git hooks (optional but recommended)
Setup
# Rust core
# Python bindings (build into the active virtualenv)
Checks
These mirror CI, run them before opening a PR:
Feature flags
pythonbuilds the PyO3 bindings.advanced_examplesenables the ONNX/OpenCV-backed examples (deepsort_ort), which need ONNX Runtime and OpenCV on the system.
Run a Python example
# After `maturin develop`:
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
- For major changes, open an issue first to discuss what you would like to change.
- PRs should pass CI:
cargo fmt,cargo clippy -- -D warnings,cargo test. - Use Commitizen for commit messages:
cz commit.
Roadmap
Planned trackers and milestones live on the Roadmap page.
License
Distributed under the MIT License. See LICENSE for details.