Ultralytics YOLO27: Join the waitlist.
License YOLO
Back to Ultralytics Glossary

Object Tracking

Object tracking links detections across video frames and keeps a persistent ID on each object through motion and occlusion. How trackers work, plus code.

Object tracking is a computer vision task that locates objects in successive video frames and links those locations into trajectories, giving each object a persistent ID. A car that enters the frame as ID 7 stays ID 7 while it moves, turns, and passes briefly behind a bus, which lets a system count it once, measure its speed, and reason about where it is going. Single-object tracking follows one target chosen in the first frame, while multi-object tracking (MOT), the most common form in practice, follows every object of the classes of interest at once.

How Object Tracking Works#

Most multi-object trackers use tracking-by-detection: an object detection model finds objects in each frame, and a tracker links those detections over time. The tracker's tools are a motion model, usually a Kalman filter, box overlap measured by Intersection over Union (IoU), optional appearance embeddings from an object re-identification (Re-ID) model, and a linear assignment solver such as the Hungarian algorithm. Every frame, it runs four steps:

  1. Predict: The Kalman filter, assuming constant velocity, predicts where each existing track's box will appear in the new frame.
  2. Score: The tracker builds a cost matrix between predicted tracks and new detections from IoU, motion, and, in some trackers, appearance similarity.
  3. Assign: The solver picks the lowest-cost one-to-one matches.
  4. Manage tracks: Matched tracks update their state, confident unmatched detections start new tracks, and unmatched tracks are kept as "lost" for a buffer of frames so they can be recovered after an occlusion.

The lifecycle step is what keeps IDs stable when detections drop out for a few frames:

The core design dates to SORT in 2016, which used only a Kalman filter, IoU costs, and the Hungarian algorithm. DeepSORT added appearance features to recover identities after occlusion, and ByteTrack improved recall by also matching low-confidence detections, which are often partly occluded objects, in a second pass. Later trackers add camera-motion compensation for moving cameras and richer association rules for crowds.

Tracking vs. Detection#

A detector is stateless: it processes each frame independently, so the car in frame 1 and the car in frame 2 are unrelated detections. Tracking adds state that carries identities from frame to frame, which counting, dwell time, and speed estimation all depend on. Tracking also differs from point tracking and optical flow, which follow individual pixels or surface points without grouping them into labeled objects.

Ultralytics YOLO's track mode adds this state to any YOLO26 detection, segmentation, pose, or oriented-box model, with six built-in trackers including ByteTrack, BoT-SORT, and the default, TrackTrack:

from ultralytics import YOLO

# Load a YOLO26 detector; track() pairs it with a tracker that assigns persistent IDs
model = YOLO("yolo26n.pt")

detections, track_ids = 0, set()
for result in model.track(
    "https://github.com/ultralytics/assets/releases/download/v0.0.0/decelera_portrait_min.mov", stream=True
):
    detections += len(result.boxes)
    if result.boxes.is_track:
        track_ids.update(result.boxes.id.int().tolist())

print(f"Detections summed over all frames: {detections}")
print(f"Unique tracked objects: {len(track_ids)}")

The unique ID count is smaller than the summed detections because each ID stands for one object across every frame in which it appears.

Real-World Applications#

  • Traffic monitoring and speed estimation: Tracking each vehicle across frames supports counting, lane-level flow analysis, and speed estimates from the distance a track covers per second.
  • Retail analytics: Store cameras track shoppers to measure footfall, queue length, and dwell time in front of displays without counting the same person twice.
  • Sports analysis: Broadcasters and coaches track players and the ball to compute distance covered, speed, and team formations.
  • Autonomous vehicles and robotics: Perception stacks track pedestrians and vehicles to estimate their velocities and predict where they will be in the next second.

Measuring Tracking Quality#

Trackers are compared on benchmarks such as MOT17, MOT20 for dense crowds, and DanceTrack for people who look alike and move unpredictably. MOTA sums misses, false positives, and identity switches into one score dominated by detection quality, IDF1 measures how consistently each true object keeps a single ID, and HOTA balances both as the geometric mean of detection accuracy and association accuracy.

Explore solutions

Computer vision in sports

Computer vision in sports

Discover how Ultralytics YOLO powers sports vision with player and ball tracking, performance analytics, coaching insights, and athlete rehabilitation.
Learn more
Computer vision for aerial imagery

Computer vision for aerial imagery

Turn drone and aerial imagery into real-time insights for agriculture, aquaculture, conservation, and geospatial analysis with Ultralytics YOLO.
Learn more
Computer vision in aerospace

Computer vision in aerospace

Apply computer vision in aerospace with Ultralytics YOLO for aircraft inspection, runway FOD detection, airport ground operations, and composite defect detection.
Learn more
Computer vision in security

Computer vision in security

Protect every site with Ultralytics YOLO models. Vision AI powers perimeter monitoring, threat detection, license-plate recognition, and workplace safety.
Learn more
Computer vision in robotics

Computer vision in robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Computer vision in logistics

Computer vision in logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Computer vision in retail

Computer vision in retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Computer vision in healthcare

Computer vision in healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Computer vision in manufacturing

Computer vision in manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Computer vision in automotive

Computer vision in automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Computer vision in agriculture

Computer vision in agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more

Let's build the future of AI together!

Begin your journey with the future of machine learning