trackflow-python 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. trackflow_python-0.1.0/.github/workflows/ci.yml +29 -0
  2. trackflow_python-0.1.0/.github/workflows/pages.yml +33 -0
  3. trackflow_python-0.1.0/.github/workflows/publish.yml +27 -0
  4. trackflow_python-0.1.0/.gitignore +30 -0
  5. trackflow_python-0.1.0/LICENSE +199 -0
  6. trackflow_python-0.1.0/PKG-INFO +178 -0
  7. trackflow_python-0.1.0/README.md +134 -0
  8. trackflow_python-0.1.0/pyproject.toml +90 -0
  9. trackflow_python-0.1.0/src/trackflow/__init__.py +44 -0
  10. trackflow_python-0.1.0/src/trackflow/benchmark.py +253 -0
  11. trackflow_python-0.1.0/src/trackflow/cli.py +395 -0
  12. trackflow_python-0.1.0/src/trackflow/detector.py +362 -0
  13. trackflow_python-0.1.0/src/trackflow/homography.py +222 -0
  14. trackflow_python-0.1.0/src/trackflow/inspector.py +282 -0
  15. trackflow_python-0.1.0/src/trackflow/inspector_ui.html +451 -0
  16. trackflow_python-0.1.0/src/trackflow/models.py +184 -0
  17. trackflow_python-0.1.0/src/trackflow/pipeline.py +406 -0
  18. trackflow_python-0.1.0/src/trackflow/privacy.py +143 -0
  19. trackflow_python-0.1.0/src/trackflow/reid.py +417 -0
  20. trackflow_python-0.1.0/src/trackflow/sinks.py +308 -0
  21. trackflow_python-0.1.0/src/trackflow/tracker.py +558 -0
  22. trackflow_python-0.1.0/src/trackflow/types.py +224 -0
  23. trackflow_python-0.1.0/tests/test_detector.py +81 -0
  24. trackflow_python-0.1.0/tests/test_pipeline_inspector_benchmark.py +144 -0
  25. trackflow_python-0.1.0/tests/test_privacy_homography.py +63 -0
  26. trackflow_python-0.1.0/tests/test_reid_query.py +99 -0
  27. trackflow_python-0.1.0/tests/test_tracker.py +78 -0
  28. trackflow_python-0.1.0/web/app.js +303 -0
  29. trackflow_python-0.1.0/web/index.html +85 -0
  30. trackflow_python-0.1.0/web/tracker.js +135 -0
@@ -0,0 +1,29 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.10", "3.12"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - name: Install uv
19
+ uses: astral-sh/setup-uv@v5
20
+ - name: Set up Python ${{ matrix.python-version }}
21
+ run: uv python install ${{ matrix.python-version }}
22
+ - name: Install dependencies
23
+ run: uv sync --python ${{ matrix.python-version }} --extra dev
24
+ - name: Lint with ruff
25
+ run: uv run ruff check src tests
26
+ - name: Run tests
27
+ run: uv run pytest
28
+ - name: Build wheel & sdist
29
+ run: uv build
@@ -0,0 +1,33 @@
1
+ name: Deploy WebGPU Playground to GitHub Pages
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ paths:
7
+ - "web/**"
8
+ - ".github/workflows/pages.yml"
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: read
13
+ pages: write
14
+ id-token: write
15
+
16
+ concurrency:
17
+ group: pages
18
+ cancel-in-progress: false
19
+
20
+ jobs:
21
+ deploy:
22
+ environment:
23
+ name: github-pages
24
+ url: ${{ steps.deployment.outputs.page_url }}
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+ - uses: actions/configure-pages@v5
29
+ - uses: actions/upload-pages-artifact@v3
30
+ with:
31
+ path: web
32
+ - id: deployment
33
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,27 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ push:
7
+ tags:
8
+ - "v*.*.*"
9
+
10
+ permissions:
11
+ id-token: write
12
+ contents: read
13
+
14
+ jobs:
15
+ publish:
16
+ runs-on: ubuntu-latest
17
+ environment:
18
+ name: pypi
19
+ url: https://pypi.org/p/trackflow-python
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ - name: Install uv
23
+ uses: astral-sh/setup-uv@v5
24
+ - name: Build distributions
25
+ run: uv build
26
+ - name: Publish to PyPI
27
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,30 @@
1
+ # Python / uv
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.egg-info/
6
+ .eggs/
7
+ dist/
8
+ build/
9
+ .venv/
10
+ .pytest_cache/
11
+ .ruff_cache/
12
+ .mypy_cache/
13
+ .coverage
14
+ htmlcov/
15
+
16
+ # Local run outputs & media
17
+ runs/
18
+ outputs/
19
+ *.mp4
20
+ *.avi
21
+ *.mov
22
+ *.mkv
23
+ *.parquet
24
+ *.jsonl
25
+
26
+ # OS / Editors
27
+ .DS_Store
28
+ .vscode/
29
+ .idea/
30
+ *.swp
@@ -0,0 +1,199 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the Licensor as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated into the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or indirect patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to bear prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright notices, patent notices,
102
+ trademark notices, and attribution notices from the Source
103
+ form of the Work, excluding those notices that do not
104
+ pertain to any part of the Work; and
105
+
106
+ (d) If the Work includes a "Notice" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such Notice file, if any, in at least one of the
110
+ following places: within a Notice text file distributed
111
+ as part of the Derivative Works; within the Source form or
112
+ documentation, if provided along with the Derivative Works; or,
113
+ within a Display generated by the Derivative Works, if and
114
+ wherever such third-party notices normally appear. The contents
115
+ of the Notice file are for informational purposes only and
116
+ do not modify the License. You may add Your own attribution
117
+ notices within Derivative Works that You distribute, alongside
118
+ or as an addendum to the Notice file, provided that such
119
+ additional attribution notices cannot be construed as modifying
120
+ the License.
121
+
122
+ You may add Your own copyright notice to Your modifications and
123
+ may provide additional or different license terms and conditions
124
+ for use, reproduction, or distribution of Your modifications, or
125
+ for any such Derivative Works as a whole, provided Your use,
126
+ reproduction, and distribution of the Work otherwise complies with
127
+ the conditions stated in this License.
128
+
129
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
130
+ any Contribution intentionally submitted for inclusion in the Work
131
+ by You to the Licensor shall be under the terms and conditions of
132
+ this License, without any additional terms or conditions.
133
+ Notwithstanding the above, nothing herein shall supersede or modify
134
+ the terms of any separate license agreement you may have with
135
+ Licensor regarding such Contributions.
136
+
137
+ 6. Trademarks. This License does not grant permission to use the trade
138
+ names, trademarks, service marks, or product names of the Work,
139
+ except as required for reasonable and customary use in describing the
140
+ origin of the Work and reproducing the origin of the Work's content.
141
+
142
+ 7. Disclaimer of Warranty. Unless required by applicable law or
143
+ agreed to in writing, Licensor provides the Work (and each
144
+ Contributor provides its Contributions) on an "AS IS" BASIS,
145
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
146
+ implied, including without limitation any warranties or conditions
147
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A
148
+ PARTICULAR PURPOSE. You are solely responsible for conducting your
149
+ own determination of the suitability of the Work and assuming any
150
+ risks associated with Your use of the Work.
151
+
152
+ 8. Limitation of Warranty. In no event and under no legal theory,
153
+ whether in tort (including negligence), contract, or otherwise,
154
+ unless required by applicable law (such as deliberate and grossly
155
+ negligent acts) or agreed to in writing, shall any Contributor be
156
+ liable to You for any damages, including any direct, indirect,
157
+ special, incidental, or consequential damages of any character arising
158
+ as part of this License or out of the use or results of the Work
159
+ (including but not limited to damages for loss of goodwill,
160
+ work stoppage, computer failure or malfunction, or any and all
161
+ other commercial damages or losses), even if such Contributor
162
+ has been advised of the possibility of such damages.
163
+
164
+ 9. Accepting Warranty or Additional Liability. While redistributing
165
+ the Work or Derivative Works thereof, You may choose to offer,
166
+ and agree to offer, acceptance of support, written warranty, or
167
+ additional liability obligations and/or rights consistent with this
168
+ License. However, in accepting such obligations, You may act only
169
+ on Your own behalf and on Your sole responsibility, not on behalf
170
+ of any other Contributor, and only if You agree to indemnify,
171
+ defend, and protect each Contributor from any liability incurred
172
+ by, or claims asserted against, each Contributor by reason of your
173
+ accepting any such warranty or additional liability.
174
+
175
+ END OF TERMS AND CONDITIONS
176
+
177
+ APPENDIX: How to apply the Apache License to your work.
178
+
179
+ To apply the Apache License to your work, attach the following
180
+ boilerplate notice, with the fields enclosed by brackets "[]"
181
+ replaced with your own identifying information. (Don't include
182
+ the brackets!) The text should be enclosed in the appropriate
183
+ commented syntax for the file format. We also recommend that a
184
+ file name or class name be included on the same line as the
185
+ copyright notice for the same status as the printed page.
186
+
187
+ Copyright 2026 Ouail Bendidi
188
+
189
+ Licensed under the Apache License, Version 2.0 (the "License");
190
+ you may not use this file except in compliance with the License.
191
+ You may obtain a copy of the License at
192
+
193
+ http://www.apache.org/licenses/LICENSE-2.0
194
+
195
+ Unless required by applicable law or agreed to in writing, software
196
+ distributed under the License is distributed on an "AS IS" BASIS,
197
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
198
+ implied. See the License for the specific language governing permissions
199
+ and limitations under the License.
@@ -0,0 +1,178 @@
1
+ Metadata-Version: 2.5
2
+ Name: trackflow-python
3
+ Version: 0.1.0
4
+ Summary: Modern real-time people & object tracking toolkit — ONNX RT-DETRv2/RF-DETR/D-FINE + ByteTrack/BoT-SORT, natural-language search, visual debugger, floorplan homography & privacy-first anonymization.
5
+ Project-URL: Homepage, https://obendidi.github.io/trackflow/
6
+ Project-URL: Repository, https://github.com/obendidi/trackflow
7
+ Project-URL: Issues, https://github.com/obendidi/trackflow/issues
8
+ Author: Ouail Bendidi
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: bytetrack,computer-vision,d-fine,mot,multi-object-tracking,object-tracking,onnxruntime,people-tracking,rf-detr,rtdetr
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: License :: OSI Approved :: Apache Software License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Multimedia :: Video
24
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
25
+ Classifier: Topic :: Scientific/Engineering :: Image Recognition
26
+ Requires-Python: >=3.10
27
+ Requires-Dist: huggingface-hub>=0.24
28
+ Requires-Dist: numpy>=1.26
29
+ Requires-Dist: onnxruntime>=1.17
30
+ Requires-Dist: opencv-python-headless>=4.9
31
+ Requires-Dist: pyarrow>=15.0
32
+ Requires-Dist: rich>=13.7
33
+ Requires-Dist: scipy>=1.11
34
+ Requires-Dist: tokenizers>=0.19
35
+ Requires-Dist: typer>=0.12
36
+ Provides-Extra: cuda
37
+ Requires-Dist: onnxruntime-gpu>=1.17; extra == 'cuda'
38
+ Provides-Extra: dev
39
+ Requires-Dist: pytest>=8.0; extra == 'dev'
40
+ Requires-Dist: ruff>=0.6; extra == 'dev'
41
+ Provides-Extra: display
42
+ Requires-Dist: opencv-python>=4.9; extra == 'display'
43
+ Description-Content-Type: text/markdown
44
+
45
+ # Trackflow
46
+
47
+ **Real-time people & object tracking that goes beyond boxes and IDs.**
48
+
49
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
50
+ [![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB.svg)](pyproject.toml)
51
+
52
+ > **Looking for the original 2017 `Tracking-with-darkflow` (YOLOv2 + DeepSORT + TensorFlow 1.0)?**
53
+ > It is preserved untouched on the [`legacy-2017`](https://github.com/obendidi/trackflow/tree/legacy-2017) branch and [`v1.0-legacy-2017`](https://github.com/obendidi/trackflow/releases/tag/v1.0-legacy-2017) tag under GPL-3.0.
54
+
55
+ ---
56
+
57
+ ## Why Trackflow?
58
+
59
+ In July 2017, this repository wired YOLOv2 (`darkflow`) to DeepSORT using TensorFlow 1.0, OpenCV 3, Cython builds, 3 git submodules, and manual Google Drive weight downloads (~14 FPS on a GTX 1080).
60
+
61
+ Plain `YOLO + ByteTrack` is now commoditized. **Trackflow v2** is a clean-room **Apache-2.0** toolkit built for everything that happens **above** raw bounding boxes:
62
+
63
+ 1. **Zero-Friction Modern Core:** One command (`uvx trackflow run video.mp4`), Apache-2.0 end-to-end transformers (**D-FINE**, **RT-DETRv2**, **RF-DETR**), **ByteTrack & BoT-SORT**, ONNX Runtime (**Apple Silicon CoreML / NVIDIA CUDA / CPU**), and data-first exports (**Parquet / JSONL / CSV / HTML report**).
64
+ 2. **Natural-Language Querying & Track Cards:** Prompt-to-track (`--query "person in red jacket with a backpack"` via ONNX CLIP / SigLIP), persistent **Track Cards** with **cross-exit long-term Re-ID**, and post-run `trackflow search`.
65
+ 3. **Visual Track Debugger & 4-Point Floorplan Homography:** Launch `trackflow inspect` to scrub timelines, flag ID switches, compare trackers side-by-side, and click 4 ground corners to project 2D tracks onto bird's-eye trajectories, heatmaps, and dwell zones.
66
+ 4. **Privacy-First Mode & Zero-Install WebGPU Playground:** Built-in `--anonymize` (`face-blur`, `blur`, `pixelate`, or zero-PII `skeleton`-only rendering) plus a 100% local in-browser [**WebGPU Playground**](https://obendidi.github.io/trackflow/).
67
+ 5. **2017 vs. 2026 Benchmark Suite:** Built-in `trackflow benchmark --split-screen` harness celebrating 9 years of real-time tracking progress.
68
+
69
+ ---
70
+
71
+ ## Quickstart
72
+
73
+ ```bash
74
+ # Run immediately with uvx (no manual weight downloads or Cython builds)
75
+ uvx trackflow-python run street.mp4
76
+
77
+ # Or install via pip / uv (provides the `trackflow` CLI and `import trackflow`)
78
+ pip install trackflow-python
79
+ trackflow run street.mp4
80
+ ```
81
+
82
+ ### 1. Real-Time Tracking + Structured Exports
83
+ ```bash
84
+ trackflow run crowd.mp4 \
85
+ --model dfine-n \
86
+ --tracker botsort \
87
+ --classes person \
88
+ --export parquet,jsonl,csv,html
89
+ ```
90
+ Query the Parquet output directly with DuckDB:
91
+ ```sql
92
+ SELECT track_id, COUNT(*) AS frames, AVG(confidence) AS avg_conf
93
+ FROM 'runs/latest/tracks.parquet'
94
+ GROUP BY track_id ORDER BY frames DESC;
95
+ ```
96
+
97
+ ### 2. Natural-Language Prompt-to-Track & Post-Run Search
98
+ ```bash
99
+ # Highlight matching people live + build persistent Track Cards with cross-exit Re-ID
100
+ trackflow run mall.mp4 --reid clip --query "person in red jacket with a backpack"
101
+
102
+ # Search the completed run again anytime without re-running detection
103
+ trackflow search runs/latest "person carrying a suitcase"
104
+ ```
105
+
106
+ ### 3. Visual Track Debugger, Tracker Comparison & 4-Point Floorplan
107
+ ```bash
108
+ # Compare ByteTrack vs BoT-SORT side-by-side on the same video
109
+ trackflow compare crowd.mp4 --trackers bytetrack,botsort --inspect
110
+
111
+ # Or open the Visual Track Debugger & 4-Point Homography Studio on any run
112
+ trackflow inspect runs/latest
113
+ ```
114
+
115
+ ### 4. Privacy-First Anonymization
116
+ ```bash
117
+ # Blur faces/heads only
118
+ trackflow run lobby.mp4 --anonymize face-blur
119
+
120
+ # Zero-PII pose-skeleton-only analytics (no raw video pixels saved)
121
+ trackflow run lobby.mp4 --anonymize skeleton
122
+ ```
123
+
124
+ ### 5. Reproducible 2017 vs. 2026 Benchmark
125
+ ```bash
126
+ trackflow benchmark crowd.mp4 --models dfine-n,rtdetr-v2-r18 --trackers bytetrack,botsort --split-screen
127
+ ```
128
+
129
+ ---
130
+
131
+ ## Zero-Install WebGPU Browser Playground
132
+
133
+ Try Trackflow immediately in your browser at **[obendidi.github.io/trackflow](https://obendidi.github.io/trackflow/)** — 100% local WebGPU/WASM execution with zero video upload.
134
+
135
+ The [`web/`](web/) directory powers the playground via `@huggingface/transformers` using the exact same `onnx-community` ONNX models (`rtdetr_v2_r18vd-ONNX`, `dfine_n_coco-ONNX`) plus in-browser ByteTrack and live privacy anonymization. To run it locally:
136
+
137
+ ```bash
138
+ python3 -m http.server 8080 --directory web
139
+ ```
140
+
141
+ ---
142
+
143
+ ## Built-in Models
144
+
145
+ All weights auto-download and cache from Hugging Face on first run:
146
+
147
+ | Preset | Model | Size (FP32) | License | Best For |
148
+ | :--- | :--- | ---: | :--- | :--- |
149
+ | `rtdetr-v2-r18` *(default)* | RT-DETRv2 ResNet-18 | ~81 MB | Apache-2.0 | Balanced speed & dense crowd accuracy |
150
+ | `dfine-n` | D-FINE Nano (COCO) | ~15 MB | Apache-2.0 | Ultra-lightweight edge / CPU fallback |
151
+ | `rfdetr-base` | RF-DETR Base (COCO) | ~108 MB | Apache-2.0 | High-accuracy people tracking |
152
+ | `--reid clip` | CLIP ViT-B/32 (INT8 ONNX) | ~153 MB | MIT | Fast natural-language querying & Re-ID |
153
+ | `--reid siglip` | SigLIP Base (INT8 ONNX) | ~205 MB | Apache-2.0 | Fine-grained clothing/attribute queries |
154
+
155
+ ---
156
+
157
+ ## Python API
158
+
159
+ ```python
160
+ from trackflow import FloorplanHomography, TrackflowPipeline
161
+
162
+ pipeline = TrackflowPipeline(
163
+ model="dfine-n",
164
+ tracker="botsort",
165
+ reid="clip",
166
+ query="person wearing a red jacket",
167
+ anonymize="face-blur",
168
+ )
169
+ summary = pipeline.run("crowd.mp4", output_dir="runs/crowd")
170
+ print(f"{summary.unique_tracks} unique tracks at {summary.avg_fps:.1f} FPS")
171
+ ```
172
+
173
+ ---
174
+
175
+ ## License
176
+
177
+ Trackflow v2 (`main`) is licensed under the **Apache License 2.0** — see [LICENSE](LICENSE).
178
+ The historical 2017 codebase on [`legacy-2017`](https://github.com/obendidi/trackflow/tree/legacy-2017) remains under GPL-3.0.
@@ -0,0 +1,134 @@
1
+ # Trackflow
2
+
3
+ **Real-time people & object tracking that goes beyond boxes and IDs.**
4
+
5
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
6
+ [![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB.svg)](pyproject.toml)
7
+
8
+ > **Looking for the original 2017 `Tracking-with-darkflow` (YOLOv2 + DeepSORT + TensorFlow 1.0)?**
9
+ > It is preserved untouched on the [`legacy-2017`](https://github.com/obendidi/trackflow/tree/legacy-2017) branch and [`v1.0-legacy-2017`](https://github.com/obendidi/trackflow/releases/tag/v1.0-legacy-2017) tag under GPL-3.0.
10
+
11
+ ---
12
+
13
+ ## Why Trackflow?
14
+
15
+ In July 2017, this repository wired YOLOv2 (`darkflow`) to DeepSORT using TensorFlow 1.0, OpenCV 3, Cython builds, 3 git submodules, and manual Google Drive weight downloads (~14 FPS on a GTX 1080).
16
+
17
+ Plain `YOLO + ByteTrack` is now commoditized. **Trackflow v2** is a clean-room **Apache-2.0** toolkit built for everything that happens **above** raw bounding boxes:
18
+
19
+ 1. **Zero-Friction Modern Core:** One command (`uvx trackflow run video.mp4`), Apache-2.0 end-to-end transformers (**D-FINE**, **RT-DETRv2**, **RF-DETR**), **ByteTrack & BoT-SORT**, ONNX Runtime (**Apple Silicon CoreML / NVIDIA CUDA / CPU**), and data-first exports (**Parquet / JSONL / CSV / HTML report**).
20
+ 2. **Natural-Language Querying & Track Cards:** Prompt-to-track (`--query "person in red jacket with a backpack"` via ONNX CLIP / SigLIP), persistent **Track Cards** with **cross-exit long-term Re-ID**, and post-run `trackflow search`.
21
+ 3. **Visual Track Debugger & 4-Point Floorplan Homography:** Launch `trackflow inspect` to scrub timelines, flag ID switches, compare trackers side-by-side, and click 4 ground corners to project 2D tracks onto bird's-eye trajectories, heatmaps, and dwell zones.
22
+ 4. **Privacy-First Mode & Zero-Install WebGPU Playground:** Built-in `--anonymize` (`face-blur`, `blur`, `pixelate`, or zero-PII `skeleton`-only rendering) plus a 100% local in-browser [**WebGPU Playground**](https://obendidi.github.io/trackflow/).
23
+ 5. **2017 vs. 2026 Benchmark Suite:** Built-in `trackflow benchmark --split-screen` harness celebrating 9 years of real-time tracking progress.
24
+
25
+ ---
26
+
27
+ ## Quickstart
28
+
29
+ ```bash
30
+ # Run immediately with uvx (no manual weight downloads or Cython builds)
31
+ uvx trackflow-python run street.mp4
32
+
33
+ # Or install via pip / uv (provides the `trackflow` CLI and `import trackflow`)
34
+ pip install trackflow-python
35
+ trackflow run street.mp4
36
+ ```
37
+
38
+ ### 1. Real-Time Tracking + Structured Exports
39
+ ```bash
40
+ trackflow run crowd.mp4 \
41
+ --model dfine-n \
42
+ --tracker botsort \
43
+ --classes person \
44
+ --export parquet,jsonl,csv,html
45
+ ```
46
+ Query the Parquet output directly with DuckDB:
47
+ ```sql
48
+ SELECT track_id, COUNT(*) AS frames, AVG(confidence) AS avg_conf
49
+ FROM 'runs/latest/tracks.parquet'
50
+ GROUP BY track_id ORDER BY frames DESC;
51
+ ```
52
+
53
+ ### 2. Natural-Language Prompt-to-Track & Post-Run Search
54
+ ```bash
55
+ # Highlight matching people live + build persistent Track Cards with cross-exit Re-ID
56
+ trackflow run mall.mp4 --reid clip --query "person in red jacket with a backpack"
57
+
58
+ # Search the completed run again anytime without re-running detection
59
+ trackflow search runs/latest "person carrying a suitcase"
60
+ ```
61
+
62
+ ### 3. Visual Track Debugger, Tracker Comparison & 4-Point Floorplan
63
+ ```bash
64
+ # Compare ByteTrack vs BoT-SORT side-by-side on the same video
65
+ trackflow compare crowd.mp4 --trackers bytetrack,botsort --inspect
66
+
67
+ # Or open the Visual Track Debugger & 4-Point Homography Studio on any run
68
+ trackflow inspect runs/latest
69
+ ```
70
+
71
+ ### 4. Privacy-First Anonymization
72
+ ```bash
73
+ # Blur faces/heads only
74
+ trackflow run lobby.mp4 --anonymize face-blur
75
+
76
+ # Zero-PII pose-skeleton-only analytics (no raw video pixels saved)
77
+ trackflow run lobby.mp4 --anonymize skeleton
78
+ ```
79
+
80
+ ### 5. Reproducible 2017 vs. 2026 Benchmark
81
+ ```bash
82
+ trackflow benchmark crowd.mp4 --models dfine-n,rtdetr-v2-r18 --trackers bytetrack,botsort --split-screen
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Zero-Install WebGPU Browser Playground
88
+
89
+ Try Trackflow immediately in your browser at **[obendidi.github.io/trackflow](https://obendidi.github.io/trackflow/)** — 100% local WebGPU/WASM execution with zero video upload.
90
+
91
+ The [`web/`](web/) directory powers the playground via `@huggingface/transformers` using the exact same `onnx-community` ONNX models (`rtdetr_v2_r18vd-ONNX`, `dfine_n_coco-ONNX`) plus in-browser ByteTrack and live privacy anonymization. To run it locally:
92
+
93
+ ```bash
94
+ python3 -m http.server 8080 --directory web
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Built-in Models
100
+
101
+ All weights auto-download and cache from Hugging Face on first run:
102
+
103
+ | Preset | Model | Size (FP32) | License | Best For |
104
+ | :--- | :--- | ---: | :--- | :--- |
105
+ | `rtdetr-v2-r18` *(default)* | RT-DETRv2 ResNet-18 | ~81 MB | Apache-2.0 | Balanced speed & dense crowd accuracy |
106
+ | `dfine-n` | D-FINE Nano (COCO) | ~15 MB | Apache-2.0 | Ultra-lightweight edge / CPU fallback |
107
+ | `rfdetr-base` | RF-DETR Base (COCO) | ~108 MB | Apache-2.0 | High-accuracy people tracking |
108
+ | `--reid clip` | CLIP ViT-B/32 (INT8 ONNX) | ~153 MB | MIT | Fast natural-language querying & Re-ID |
109
+ | `--reid siglip` | SigLIP Base (INT8 ONNX) | ~205 MB | Apache-2.0 | Fine-grained clothing/attribute queries |
110
+
111
+ ---
112
+
113
+ ## Python API
114
+
115
+ ```python
116
+ from trackflow import FloorplanHomography, TrackflowPipeline
117
+
118
+ pipeline = TrackflowPipeline(
119
+ model="dfine-n",
120
+ tracker="botsort",
121
+ reid="clip",
122
+ query="person wearing a red jacket",
123
+ anonymize="face-blur",
124
+ )
125
+ summary = pipeline.run("crowd.mp4", output_dir="runs/crowd")
126
+ print(f"{summary.unique_tracks} unique tracks at {summary.avg_fps:.1f} FPS")
127
+ ```
128
+
129
+ ---
130
+
131
+ ## License
132
+
133
+ Trackflow v2 (`main`) is licensed under the **Apache License 2.0** — see [LICENSE](LICENSE).
134
+ The historical 2017 codebase on [`legacy-2017`](https://github.com/obendidi/trackflow/tree/legacy-2017) remains under GPL-3.0.