|
| 1 | +<div align="center"> |
| 2 | + <img width="200" src="https://raw.githubusercontent.com/roboflow/trackers/refs/heads/main/docs/assets/logo-trackers-violet.svg" alt="trackers logo"> |
| 3 | + <h1>trackers</h1> |
| 4 | + <p>Plug-and-play multi-object tracking for any detection model.</p> |
| 5 | + |
1 | 6 | [](https://badge.fury.io/py/trackers) |
2 | 7 | [](https://pypistats.org/packages/trackers) |
3 | 8 | [](https://github.com/roboflow/trackers/blob/main/LICENSE.md) |
4 | 9 | [](https://badge.fury.io/py/trackers) |
5 | 10 | [](https://huggingface.co/spaces/Roboflow/Trackers) |
6 | 11 | [](https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/how-to-track-objects-with-bytetrack-tracker.ipynb) |
| 12 | +[](https://discord.gg/GbfgXGJ8Bk) |
7 | 13 |
|
8 | | -<div align="center"> |
9 | | - <h1 align="center">trackers</h1> |
10 | | - <img width="200" src="https://raw.githubusercontent.com/roboflow/trackers/refs/heads/main/docs/assets/logo-trackers-violet.svg" alt="trackers logo"> |
11 | 14 | </div> |
12 | 15 |
|
13 | | -`trackers` gives you clean, modular re-implementations of leading multi-object tracking algorithms released under the permissive Apache 2.0 license. You combine them with any detection model you already use. |
| 16 | +## Try It |
14 | 17 |
|
15 | | -https://github.com/user-attachments/assets/eef9b00a-cfe4-40f7-a495-954550e3ef1f |
| 18 | +No install needed. Try trackers in your browser with our [Hugging Face Playground](https://huggingface.co/spaces/roboflow/trackers). |
16 | 19 |
|
17 | 20 | ## Install |
18 | 21 |
|
19 | | -You can install and use `trackers` in a [**Python>=3.10**](https://www.python.org/) environment. For detailed installation instructions, including installing from source and setting up a local development environment, check out our [install](https://trackers.roboflow.com/develop/learn/install/) page. |
20 | | - |
21 | 22 | ```bash |
22 | 23 | pip install trackers |
23 | 24 | ``` |
24 | 25 |
|
25 | 26 | <details> |
26 | 27 | <summary>install from source</summary> |
27 | 28 |
|
28 | | -<br> |
29 | | - |
30 | | -By installing `trackers` from source, you can explore the most recent features and enhancements that have not yet been officially released. Please note that these updates are still in development and may not be as stable as the latest published release. |
31 | | - |
32 | 29 | ```bash |
33 | | -pip install https://github.com/roboflow/trackers/archive/refs/heads/develop.zip |
| 30 | +pip install git+https://github.com/roboflow/trackers.git |
34 | 31 | ``` |
35 | 32 |
|
36 | 33 | </details> |
37 | 34 |
|
38 | | -## Quickstart |
39 | | - |
40 | | -Use the `trackers` CLI to quickly test how our tracking algorithms perform on your videos and streams. This feature is experimental; see the [CLI documentation](https://trackers.roboflow.com/develop/learn/track) for details. |
41 | | - |
42 | | -```bash |
43 | | -trackers track --source source.mp4 --output output.mp4 --model rfdetr-nano --tracker bytetrack |
44 | | -``` |
45 | | - |
46 | | -## Tracking Algorithms |
47 | | - |
48 | | -`trackers` gives you clean, modular re-implementations of leading multi-object tracking algorithms. The package currently supports [SORT](https://arxiv.org/abs/1602.00763) and [ByteTrack](https://arxiv.org/abs/2110.06864). [OC-SORT](https://arxiv.org/abs/2203.14360), [BoT-SORT](https://arxiv.org/abs/2206.14651), and [McByte](https://arxiv.org/abs/2506.01373) support is coming soon. For comparisons, see the [tracker comparison](https://trackers.roboflow.com/develop/trackers/comparison/) page. |
49 | | - |
50 | | -| Algorithm | MOT17 HOTA | MOT17 IDF1 | MOT17 MOTA | SportsMOT HOTA | SoccerNet HOTA | |
51 | | -| :-------: | :--------: | :--------: | :--------: | :------------: | :------------: | |
52 | | -| SORT | 58.4 | 69.9 | 67.2 | 70.9 | 81.6 | |
53 | | -| ByteTrack | **60.1** | **73.2** | **74.1** | **73.0** | **84.0** | |
54 | | -| OC-SORT | — | — | — | — | — | |
55 | | -| BoT-SORT | — | — | — | — | — | |
56 | | -| McByte | — | — | — | — | — | |
| 35 | +https://github.com/user-attachments/assets/eef9b00a-cfe4-40f7-a495-954550e3ef1f |
57 | 36 |
|
58 | | -## Integration |
| 37 | +## Track from CLI |
59 | 38 |
|
60 | | -With a modular design, `trackers` lets you combine object detectors from different libraries with the tracker of your choice. |
| 39 | +Point at a video, webcam, RTSP stream, or image directory. Get tracked output. |
61 | 40 |
|
62 | | -```python |
63 | | -import cv2 |
64 | | -from rfdetr import RFDETRNano |
65 | | -from trackers import ByteTrackTracker |
66 | | - |
67 | | -model = RFDETRNano() |
68 | | -tracker = ByteTrackTracker() |
69 | | - |
70 | | -cap = cv2.VideoCapture("source.mp4") |
71 | | -while True: |
72 | | - ret, frame = cap.read() |
73 | | - if not ret: |
74 | | - break |
| 41 | +Use our [interactive command builder](https://trackers.roboflow.com/develop/learn/track) to configure your tracking pipeline. |
75 | 42 |
|
76 | | - frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) |
77 | | - detections = model.predict(frame_rgb) |
78 | | - detections = tracker.update(detections) |
| 43 | +```bash |
| 44 | +trackers track \ |
| 45 | + --source video.mp4 \ |
| 46 | + --output output.mp4 \ |
| 47 | + --model rfdetr-medium \ |
| 48 | + --tracker bytetrack \ |
| 49 | + --show-labels \ |
| 50 | + --show-trajectories |
79 | 51 | ``` |
80 | 52 |
|
81 | | -<details> |
82 | | -<summary>run with Inference</summary> |
| 53 | +## Track from Python |
| 54 | + |
| 55 | +Plug trackers into your existing detection pipeline. Works with any detector. |
83 | 56 |
|
84 | 57 | ```python |
85 | 58 | import cv2 |
86 | 59 | import supervision as sv |
87 | 60 | from inference import get_model |
88 | 61 | from trackers import ByteTrackTracker |
89 | 62 |
|
90 | | -model = get_model(model_id="rfdetr-nano") |
| 63 | +model = get_model(model_id="rfdetr-medium") |
91 | 64 | tracker = ByteTrackTracker() |
92 | 65 |
|
93 | | -cap = cv2.VideoCapture("source.mp4") |
94 | | -while True: |
| 66 | +label_annotator = sv.LabelAnnotator() |
| 67 | +trajectory_annotator = sv.TrajectoryAnnotator() |
| 68 | + |
| 69 | +cap = cv2.VideoCapture("video.mp4") |
| 70 | +while cap.isOpened(): |
95 | 71 | ret, frame = cap.read() |
96 | 72 | if not ret: |
97 | 73 | break |
98 | 74 |
|
99 | 75 | result = model.infer(frame)[0] |
100 | 76 | detections = sv.Detections.from_inference(result) |
101 | | - detections = tracker.update(detections) |
| 77 | + tracked = tracker.update(detections) |
| 78 | + |
| 79 | + frame = label_annotator.annotate(frame, tracked) |
| 80 | + frame = trajectory_annotator.annotate(frame, tracked) |
102 | 81 | ``` |
103 | 82 |
|
104 | | -</details> |
| 83 | +## Evaluate |
105 | 84 |
|
106 | | -<details> |
107 | | -<summary>run with Ultralytics</summary> |
| 85 | +Benchmark your tracker against ground truth with standard MOT metrics. |
108 | 86 |
|
109 | | -```python |
110 | | -import cv2 |
111 | | -import supervision as sv |
112 | | -from ultralytics import YOLO |
113 | | -from trackers import ByteTrackTracker |
| 87 | +```bash |
| 88 | +trackers eval \ |
| 89 | + --gt-dir data/gt \ |
| 90 | + --tracker-dir data/trackers \ |
| 91 | + --metrics CLEAR HOTA Identity |
| 92 | +``` |
114 | 93 |
|
115 | | -model = YOLO("yolo11n.pt") |
116 | | -tracker = ByteTrackTracker() |
| 94 | +``` |
| 95 | +Sequence MOTA HOTA IDF1 IDSW |
| 96 | +---------------------------------------------------------- |
| 97 | +MOT17-02-FRCNN 75.600 62.300 72.100 42 |
| 98 | +MOT17-04-FRCNN 78.200 65.100 74.800 31 |
| 99 | +---------------------------------------------------------- |
| 100 | +COMBINED 75.033 62.400 72.033 73 |
| 101 | +``` |
117 | 102 |
|
118 | | -cap = cv2.VideoCapture("source.mp4") |
119 | | -while True: |
120 | | - ret, frame = cap.read() |
121 | | - if not ret: |
122 | | - break |
| 103 | +## Algorithms |
123 | 104 |
|
124 | | - result = model(frame)[0] |
125 | | - detections = sv.Detections.from_ultralytics(result) |
126 | | - detections = tracker.update(detections) |
127 | | -``` |
| 105 | +Clean, modular implementations of leading trackers. See the [tracker comparison](https://trackers.roboflow.com/develop/trackers/comparison/) for detailed benchmarks. |
128 | 106 |
|
129 | | -</details> |
| 107 | +| Algorithm | MOT17 | SportsMOT | SoccerNet | |
| 108 | +| :-------------------------------------------: | :------: | :-------: | :-------: | |
| 109 | +| [SORT](https://arxiv.org/abs/1602.00763) | 58.4 | 70.9 | 81.6 | |
| 110 | +| [ByteTrack](https://arxiv.org/abs/2110.06864) | **60.1** | **73.0** | **84.0** | |
| 111 | +| [OC-SORT](https://arxiv.org/abs/2203.14360) | — | — | — | |
| 112 | +| [BoT-SORT](https://arxiv.org/abs/2206.14651) | — | — | — | |
| 113 | +| [McByte](https://arxiv.org/abs/2506.01373) | — | — | — | |
130 | 114 |
|
131 | | -## License |
| 115 | +## Contributing |
132 | 116 |
|
133 | | -The code is released under the [Apache 2.0 license](https://github.com/roboflow/trackers/blob/main/LICENSE). |
| 117 | +We welcome contributions. Read our [contributor guidelines](https://github.com/roboflow/trackers/blob/main/CONTRIBUTING.md) to get started. |
134 | 118 |
|
135 | | -## Contribution |
| 119 | +## License |
136 | 120 |
|
137 | | -We welcome all contributions—whether it’s reporting issues, suggesting features, or submitting pull requests. Please read our [contributor guidelines](https://github.com/roboflow/trackers/blob/main/CONTRIBUTING.md) to learn about our processes and best practices. |
| 121 | +The code is released under the [Apache 2.0 license](https://github.com/roboflow/trackers/blob/main/LICENSE). |
0 commit comments