docs/en/datasets/track/index.md
Multi-object tracking is a critical component in video analytics that identifies objects and maintains unique IDs for each detected object across video frames. Ultralytics YOLO provides powerful tracking capabilities that can be applied to various domains including surveillance, sports analytics, and traffic monitoring.
Ultralytics tracking currently reuses detection, segmentation, or pose models without requiring tracker-specific training. Native tracker-training support is under active development.
Ultralytics YOLO supports the following tracking algorithms:
botsort.yaml to enable this tracker (default)bytetrack.yaml to enable this tracker!!! example
=== "Python"
```python
from ultralytics import YOLO
model = YOLO("yolo26n.pt")
results = model.track(source="https://youtu.be/LNwODJXcvt4", conf=0.1, iou=0.7, show=True)
```
=== "CLI"
```bash
yolo track model=yolo26n.pt source="https://youtu.be/LNwODJXcvt4" conf=0.1 iou=0.7 show=True
```
For continuous tracking across video frames, you can use the persist=True parameter:
!!! example
=== "Python"
```python
import cv2
from ultralytics import YOLO
# Load the YOLO model
model = YOLO("yolo26n.pt")
# Open the video file
cap = cv2.VideoCapture("path/to/video.mp4")
while cap.isOpened():
success, frame = cap.read()
if success:
# Run tracking with persistence between frames
results = model.track(frame, persist=True)
# Visualize the results
annotated_frame = results[0].plot()
cv2.imshow("Tracking", annotated_frame)
if cv2.waitKey(1) & 0xFF == ord("q"):
break
else:
break
cap.release()
cv2.destroyAllWindows()
```
To use Multi-Object Tracking with Ultralytics YOLO, you can start by using the Python or CLI examples provided. Here is how you can get started:
!!! example
=== "Python"
```python
from ultralytics import YOLO
model = YOLO("yolo26n.pt") # Load the YOLO26 model
results = model.track(source="https://youtu.be/LNwODJXcvt4", conf=0.1, iou=0.7, show=True)
```
=== "CLI"
```bash
yolo track model=yolo26n.pt source="https://youtu.be/LNwODJXcvt4" conf=0.1 iou=0.7 show=True
```
These commands load the YOLO26 model and use it for tracking objects in the given video source with specific confidence (conf) and Intersection over Union (iou) thresholds. For more details, refer to the track mode documentation.
Ultralytics is continuously enhancing its AI models. An upcoming feature will enable the training of standalone trackers. Until then, Multi-Object Detector leverages pretrained detection, segmentation, or Pose models for tracking without requiring standalone training. Stay updated by following our blog or checking the upcoming features.
Ultralytics YOLO is a state-of-the-art object detection model known for its real-time performance and high accuracy. Using YOLO for multi-object tracking provides several advantages:
For more details on setting up and using YOLO for tracking, visit our track usage guide.
Yes, you can use custom datasets for multi-object tracking with Ultralytics YOLO. While support for standalone tracker training is an upcoming feature, you can already use pretrained models on your custom datasets. Prepare your datasets in the appropriate format compatible with YOLO and follow the documentation to integrate them.
After running a tracking job with Ultralytics YOLO, the results include various data points such as tracked object IDs, their bounding boxes, and the confidence scores. Here's a brief overview of how to interpret these results:
For detailed guidance on interpreting and visualizing these results, refer to the results handling guide.
You can customize the tracker by creating a modified version of the tracker configuration file. Copy an existing tracker config file from ultralytics/cfg/trackers, modify the parameters as needed, and specify this file when running the tracker:
from ultralytics import YOLO
model = YOLO("yolo26n.pt")
results = model.track(source="video.mp4", tracker="custom_tracker.yaml")