| Crates.io | trackforge |
| lib.rs | trackforge |
| version | 0.1.8 |
| created_at | 2025-12-26 01:21:38.740721+00 |
| updated_at | 2026-01-07 21:15:05.615571+00 |
| description | A unified, high-performance computer vision tracking library. |
| homepage | https://github.com/onuralpszr/trackforge |
| repository | https://github.com/onuralpszr/trackforge |
| max_upload_size | |
| id | 2005112 |
| size | 858,409 |
[!IMPORTANT] This project is currently under active development. APIs and features are subject to change.
Trackforge is a unified, high-performance computer vision tracking library, implemented in Rust and exposed as a Python package. It provides state-of-the-art tracking algorithms like ByteTrack, optimized for speed and ease of use in both Rust and Python environments.
pyo3.Trackforge transforms detections into tracks. It is designed to be the high-speed CPU "glue" in your pipeline.
pip install trackforge
Add trackforge to your Cargo.toml:
[dependencies]
trackforge = "0.1.6" # Check crates.io for latest version
import trackforge
# (tlwh, score, class_id)
detections = [([100.0, 100.0, 50.0, 100.0], 0.9, 0)]
tracker = trackforge.ByteTrack(0.5, 30, 0.8, 0.6)
tracks = tracker.update(detections)
for t in tracks:
print(f"ID: {t[0]}, Box: {t[1]}")
DeepSORT requires appearance embeddings (re-id features) alongside detection boxes.
import trackforge
import numpy as np
# detections: [(tlwh, score, class_id), ...]
detections = [([100.0, 100.0, 50.0, 100.0], 0.9, 0)]
# embeddings: List of feature vectors (float32 list) corresponding to detections
embeddings = [[0.1, 0.2, 0.3, ...]] # Example embedding vector
tracker = trackforge.DeepSort(max_age=30, n_init=3, max_iou_distance=0.7, max_cosine_distance=0.2, nn_budget=100)
tracks = tracker.update(detections, embeddings)
for t in tracks:
# output adds confidence: (track_id, tlwh, confidence, class_id)
print(f"ID: {t.track_id}, Box: {t.tlwh}")
See examples/python/deepsort_demo.py for a full example using ultralytics YOLO and torchvision ResNet.
use trackforge::trackers::byte_track::ByteTrack;
fn main() -> anyhow::Result<()> {
// Initialize ByteTrack
let mut tracker = ByteTrack::new(0.5, 30, 0.8, 0.6);
// Detections: Vec<([f32; 4], f32, i64)>
let detections = vec![
([100.0, 100.0, 50.0, 100.0], 0.9, 0),
];
// Update
let tracks = tracker.update(detections);
for t in tracks {
println!("ID: {}, Box: {:?}", t.track_id, t.tlwh);
}
Ok(())
}
See examples/deepsort_ort.rs for a full example integrating with ort (ONNX Runtime) for Re-ID and usls for detection.
// Minimal setup
use trackforge::trackers::deepsort::DeepSort;
use trackforge::traits::AppearanceExtractor;
struct MyExtractor;
impl AppearanceExtractor for MyExtractor {
// Implement extract ...
}
let extractor = MyExtractor;
let mut tracker = DeepSort::new(extractor, ...);
This project uses maturin to manage the Rust/Python interop.
maturin: pip install maturin# Build Python bindings
maturin develop
# Run Rust tests
cargo test
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.