Computer Vision · Advanced level

Advanced level · Module 4: Object Tracking and Localization · Lesson 3 of 4

Multi-Object Tracking by Detection

Learners link detections across frames into tracks with IoU-based association, the Hungarian algorithm and Kalman prediction, and compare with Ultralytics' built-in ByteTrack tracker.

In this lesson you will

  • Associate detections across frames
  • Run and evaluate a multi-object tracker

Key concepts

tracking by detectionIoU cost matrixHungarian algorithm (linear_sum_assignment)track birth and deathID switches

The lesson

Tracking by detection runs a detector on every frame and links detections to existing tracks. Build a cost matrix of 1 − IoU between predicted track boxes (from Kalman filters) and new detections, solve it with scipy.optimize.linear_sum_assignment, start new tracks for unmatched detections and remove tracks unseen for several frames.

ByteTrack improves association by also using low-confidence detections to keep tracks alive through occlusion. Ultralytics provides it through model.track(source, tracker='bytetrack.yaml').

Evaluate by counting ID switches and fragmented tracks on a short annotated clip. Track vehicles or livestock; tracking that would identify people is outside this programme's scope.

Step by step

  1. Run the detector on each frame of a short clip.
  2. Implement IoU association with the Hungarian algorithm and Kalman prediction.
  3. Run Ultralytics tracking with ByteTrack on the same clip.
  4. Count ID switches for both on a hand-checked segment.

Practice activity

Build a simple tracker and compare it with ByteTrack on a livestock or traffic clip.

Expected result: Working tracks with ID-switch counts for both trackers.

Check your understanding

  1. What does the Hungarian algorithm solve in tracking?

    Show answer

    The best one-to-one matching between tracks and detections.

  2. What is an ID switch?

    Show answer

    A tracked object being given a different ID partway through.

Further learning

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.