Multi-object Tracking Datasets Overview
Multi-object tracking is a core part of video analytics that identifies objects and maintains a unique ID for each detected object across video frames. Ultralytics YOLO can track moving objects in videos across domains such as surveillance, sports analytics, and traffic monitoring.
Dataset Format#
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.
Available Trackers#
Ultralytics YOLO supports the following tracking algorithms:
- BoT-SORT - Use
botsort.yamlto enable this tracker - ByteTrack - Use
bytetrack.yamlto enable this tracker - OC-SORT - Use
ocsort.yamlto enable this tracker - Deep OC-SORT - Use
deepocsort.yamlto enable this tracker - FastTracker - Use
fasttrack.yamlto enable this tracker - TrackTrack - Use
tracktrack.yamlto enable this tracker (default)
Usage#
from ultralytics import YOLO
model = YOLO("yolo26n.pt")
results = model.track(source="https://youtu.be/LNwODJXcvt4", conf=0.1, iou=0.5, show=True)Persisting Tracks Between Frames#
For continuous tracking across video frames, you can use the persist=True parameter:
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()FAQ#
To use multi-object tracking with Ultralytics YOLO, start with the Python or CLI examples below:
Examplefrom ultralytics import YOLO model = YOLO("yolo26n.pt") # Load the YOLO26 model results = model.track(source="https://youtu.be/LNwODJXcvt4", conf=0.1, iou=0.5, 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:
- Real-time tracking: Achieve efficient and high-speed tracking ideal for dynamic environments.
- Flexibility with pretrained models: No need to train from scratch; simply use pretrained detection, segmentation, pose, or OBB models.
- Ease of use: Simple API integration with both Python and CLI makes setting up tracking pipelines straightforward.
- Extensive documentation and community support: Ultralytics provides comprehensive documentation and an active community forum to troubleshoot issues and enhance your tracking models.
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:
- Tracked IDs: Each object is assigned a unique ID, which helps in tracking it across frames.
- Bounding boxes: These indicate the location of tracked objects within the frame.
- Confidence scores: These reflect the model's confidence in detecting the tracked object.
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")
Comments
Ask a question, share your results, or help someone else.
