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.
Track mode does not train a tracker or require a tracker-specific dataset. Train a detection, segmentation, pose, or OBB model with that task's standard dataset format, then use the resulting weights with model.track() or yolo track. The selected tracker associates the model's predictions across frames at inference time.
Ultralytics YOLO supports the following tracking algorithms:
botsort.yaml to enable this trackerbytetrack.yaml to enable this trackerocsort.yaml to enable this trackerdeepocsort.yaml to enable this trackerfasttrack.yaml to enable this trackertracktrack.yaml to enable this tracker (default)!!! 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 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. Train a detection, segmentation, pose, or OBB model on your custom dataset, then pass its weights to model.track(). The tracker itself runs during inference and does not require separate training data.
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")