Trackflow
Real-time people and object tracking in Python and in the browser. Runs ONNX detection transformers (RT-DETRv2, RF-DETR, D-FINE) with ByteTrack or BoT-SORT, exports structured track data (Parquet, JSONL, CSV, HTML), and includes text-based track search, a local run inspector with 4-point floorplan projection, and anonymization.
Try it in the browser without installing anything: obendidi.github.io/trackflow.
Quickstart
Run directly with uvx:
uvx trackflow-python run street.mp4
Or install with pip / uv (provides the trackflow CLI and import trackflow):
pip install trackflow-python
trackflow run street.mp4
Model weights download from Hugging Face on first run and are cached locally. ONNX Runtime selects CoreML, CUDA, or CPU automatically (--device to override).
Usage
Tracking and exports
trackflow run crowd.mp4 \
--model dfine-n \
--tracker botsort --reid osnet \
--classes person \
--export parquet,jsonl,csv,html
The Parquet export can be queried directly with DuckDB:
SELECT track_id, COUNT(*) AS frames, AVG(confidence) AS avg_conf
FROM 'runs/latest/tracks.parquet'
GROUP BY track_id ORDER BY frames DESC;
Text search and re-identification
# Highlight matching people live (uses CLIP by default; --vlm siglip for finer attributes)
trackflow run mall.mp4 --query "person in red jacket with a backpack"
# Search a completed run later without re-running detection
# (requires a run created with --query or --vlm clip|siglip)
trackflow search runs/latest "person carrying a suitcase"
# Give people who leave and come back their earlier ID (opt-in, uses person Re-ID)
trackflow run mall.mp4 --reid osnet --reid-merge
CLIP and SigLIP match images to text; they cannot reliably distinguish two people in similar clothes, so they are never used for identity. --reid osnet runs a dedicated person re-identification model. Re-entry merging compares a new track against people who left before it appeared and merges only when one earlier person is clearly the best match; look-alikes stay separate. It can still make mistakes on low-resolution footage, which is why it is off by default.
Inspector, tracker comparison, and floorplan projection
# Compare ByteTrack and BoT-SORT on the same video and open the inspector
trackflow compare crowd.mp4 --trackers bytetrack,botsort --inspect
# Open the inspector on any existing run
trackflow inspect runs/latest
trackflow inspect starts a local web UI where you can scrub through frames, jump to flagged ID switches or recoveries, search track cards, compare two runs, and click 4 ground corners to project 2D tracks onto a top-down floorplan.
Anonymization
# Blur faces/heads
trackflow run lobby.mp4 --anonymize face-blur
# Draw stick figures on a blank canvas (box-based, no pose model; no video pixels saved)
trackflow run lobby.mp4 --anonymize skeleton
Available modes are face-blur, blur, pixelate, and skeleton. Anonymization covers every detected person box (including low-confidence detections and people briefly missed by the tracker), and anonymized runs do not write person crops or thumbnails. It is best effort: if the detector misses someone in a frame, that person is not blurred in that frame.
Benchmarking
trackflow benchmark crowd.mp4 --models dfine-n,rtdetr-v2-r18 --trackers bytetrack,botsort --split-screen
Runs the selected detector/tracker pairs on a video (or a generated synthetic clip if no video is given), writes a Markdown and JSON report, and with --split-screen outputs a side-by-side comparison video against the repo's 2017 baseline.
Browser demo
The live demo at obendidi.github.io/trackflow runs locally in WebGPU or WASM — video stays on your machine.
The web/ directory runs the same onnx-community ONNX models (RF-DETR Nano by default) through @huggingface/transformers, using ports of the Python detection post-processing and ByteTrack (web/detector.js and web/tracker.js, checked against Python by tests/test_web_parity.py), along with live anonymization. To run it locally:
python3 -m http.server 8080 --directory web
Models
Weights download automatically from Hugging Face on first use (trackflow models lists all presets and repo IDs):
| Preset / Flag | Model | Size | License | Notes |
|---|---|---|---|---|
rtdetr-v2-r18 (default) |
RT-DETRv2 ResNet-18 (640×640) | ~81 MB | Apache-2.0 | Good default balance for crowded scenes |
rfdetr-nano |
RF-DETR Nano (384×384) | ~108 MB | Apache-2.0 | Fast on Apple Silicon and WebGPU |
rfdetr-base |
RF-DETR Base (560×560) | ~108 MB | Apache-2.0 | Higher accuracy, heavier compute |
dfine-n |
D-FINE Nano (640×640) | ~15 MB | Apache-2.0 | Smallest download |
--reid osnet |
OSNet-AIN x1.0 person Re-ID | ~9 MB | MIT code; weights trained on MSMT17 (check dataset terms for commercial use) | BoT-SORT appearance and --reid-merge |
--vlm clip |
CLIP ViT-B/32 (INT8) | ~153 MB | MIT | Default for --query and search |
--vlm siglip |
SigLIP Base (INT8) | ~205 MB | Apache-2.0 | Better on fine clothing/attribute queries |
Python API
from trackflow import FloorplanHomography, TrackflowPipeline
pipeline = TrackflowPipeline(
model="dfine-n",
tracker="botsort",
reid="osnet", # person Re-ID for BoT-SORT
query="person wearing a red jacket", # scored with CLIP (vlm="clip" by default when query is set)
anonymize="face-blur",
)
summary = pipeline.run("crowd.mp4", output_dir="runs/crowd")
print(f"{summary.unique_tracks} unique tracks at {summary.avg_fps:.1f} FPS")
License
Apache-2.0 — see LICENSE.
The original 2017 Tracking-with-darkflow codebase (YOLOv2 + DeepSORT + TensorFlow 1.0) is kept on the legacy-2017 branch and v1.0-legacy-2017 tag under GPL-3.0.
Metadata
Release files for trackflow-python 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| trackflow_python-0.1.1.tar.gz | 138.0 kB | With provenance | Details for trackflow_python-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| trackflow_python-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for trackflow_python-0.1.1-py3-none-any.whl |
Total release size: 204.0 kB
Release files / trackflow_python-0.1.1.tar.gz
| Download URL | trackflow_python-0.1.1.tar.gz |
|---|---|
| Size | 138.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a40d4eb7685503d834af1cfbee0de26f47443225257fe5c82e8c103251b62543
|
|
BLAKE2b-256 checksum How to use checksums |
c9bbff2e39263b0485a9e4a68e3ee53f868c2757e72c3c384d6e8df1620ce491
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logRelease files / trackflow_python-0.1.1-py3-none-any.whl
| Download URL | trackflow_python-0.1.1-py3-none-any.whl |
|---|---|
| Size | 66.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
df04ab9c9e25ddfd292dbe75f45cf10655e8d8d2489875ba02fe22ca43e2be1b
|
|
BLAKE2b-256 checksum How to use checksums |
1f379b76649276d4c0fd7ea71233369802b7ae54e8f0bb9092ee9c290d9c9738
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logSecurity for trackflow-python 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for trackflow_python-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.