TL;DR
Multi-object tracking follows several objects, such as cars or pedestrians, through a video, so that each object keeps the same identity from frame to frame. A detector finds the boxes in each frame, but it does not say which box belongs to which earlier object. A tracker fixes that by predicting where each known object should now be, matching the predictions to the new detections one to one, and updating or starting each track. The most common recipe, tracking by detection, combines a Kalman Filter for prediction with an optimal matching step.
Builds on: Object Detection, Kalman Filter, Bipartite Matching, Intersection over Union · Leads to: learned trackers that match appearance and motion together, and joint detection-and-tracking models
Where it's used
Traffic and road safety. A roadside camera counts vehicles and tracks how fast each one travels. Each car needs a stable identity so that its speed and path are measured for the whole trip, not restarted in every frame.
Sports analytics. Broadcast and stadium systems track players through a match. Coaches and analysts use the paths to measure distance covered, time spent in zones and passing patterns, which only works if the same player keeps the same label after a tackle or a collision.
Retail and crowd studies. Cameras in shops or stations count visitors and measure how long each person stays in an area. Counting people across a doorway requires knowing that the person who went in is the person who came out, not a new person each frame.
Autonomous driving. A self-driving stack tracks other road users so it can predict where they will be a second from now. A pedestrian that flickers between tracks would be treated as several people, which makes the prediction worse.
How it works
Take two frames and two known objects. Track A is a 2 by 2 box at the top-left corner (0, 0) in frame 1, and it has been moving one unit to the right each frame. Track B is a 2 by 2 box at (5, 0), and it has not moved. In frame 2 the detector returns three boxes: D1 at (1, 0), D2 at (5, 0) and D3 at (20, 20). Coordinates are the top-left corner of each box. The task is to decide which detection continues which track, and whether D3 is a new object.
- Predict. Each track predicts where its object should be now. Track A moves by its velocity of one unit, so its predicted box is at (1, 0). Track B has no velocity, so its predicted box stays at (5, 0). Check: the prediction is the old position plus the velocity, nothing more.
- Measure overlap. Compare every predicted box with every detection using Intersection over Union, the shared area divided by the total area covered. Track A and D1 are identical boxes, so their IoU is 1. Track B and D2 are also identical, so their IoU is 1. Track A and D2 do not overlap, so their IoU is 0. Check: an IoU of 1 means perfect overlap, and 0 means no shared area.
- Gate. Keep only the pairs whose IoU passes a threshold, such as 0.3. Here A–D1 and B–D2 pass, and every other pair fails. D3 has no partner at all. Check: gating stops a track from being linked to a detection on the other side of the scene, however the matching step scores it.
- Match one to one. Among the allowed pairs, choose the set that uses each track and each detection at most once and has the best total score. Use cost , so lower is better. The best set is A–D1 and B–D2, with total cost 0. Check: no detection is assigned to two tracks, which is the Bipartite Matching rule.
- Update. For each matched pair, the Kalman Filter blends the prediction with the measurement. Track A's measured position agrees with its prediction, so its estimate does not change, and its velocity stays at 1. Check: the update trusts the measurement more when the prediction is uncertain, and less when the prediction is already precise.
- Start a new track. D3 matched nothing, so it becomes a new track with its own identity. It stays tentative until it has been seen in several frames, which prevents one-off false detections from creating permanent tracks. Check: the number of tracks grows only when a detection is genuinely unmatched.
- Handle misses. A track with no matching detection in a frame keeps its state and counts a miss. It is removed only after several misses in a row, which lets it survive a brief occlusion. Check: a single missed detection does not end the track.
flowchart LR T["Existing tracks"] --> P["Predict each track's box"] P --> M["Compute IoU with new detections"] M --> G["Gate: keep pairs above threshold"] G --> A["One-to-one matching"] A --> U["Update matched tracks"] A --> N["Start tracks for unmatched detections"] A --> X["Count misses on unmatched tracks"]
The math
State and motion
Describe one object by a state vector that holds its position and velocity. For a single coordinate moving at constant speed, , where is the position and is the velocity. One frame later, the motion model says
This pair of equations is a Linear Dynamical System. Here is the transition matrix, which moves the position by the velocity, and is random process noise, usually modelled as Gaussian. The detector gives a measurement , where picks out the position.
Step 1 in symbols: predict
The Kalman filter keeps a mean and a covariance , which says how uncertain the estimate is. The prediction is
where is the process noise covariance. For track A in the example, , so . The predicted position is 1, which is the predicted box at (1, 0).
Step 2 in symbols: overlap
For two axis-aligned boxes and , the intersection area is the product of the overlap widths and heights, and the union is the sum of the areas minus the intersection:
Step 4 in symbols: one-to-one matching
Let for each allowed pair. The matching chooses a set of pairs in which each track and each detection appears at most once, and minimises the total cost:
Here is the detection that track is paired with, and each detection appears at most once in . This is the assignment problem, solved exactly by the Hungarian method in Bipartite Matching. A greedy rule that always picks the best remaining pair can give a larger total, so the optimal method is used in practice.
Step 5 in symbols: update
With measurement and measurement noise covariance , the filter computes a gain and corrects the prediction:
The gain is large when the prediction is uncertain and the measurement is precise, and small in the opposite case. The next example shows the gain with numbers.
Appearance cost
When motion alone is ambiguous, for example when two people cross, each detection can also carry an appearance embedding . The similarity of two embeddings is the Cosine Similarity , the appearance cost is , and a combined cost mixes it with the motion cost, , with between 0 and 1.
Worked examples
Box a is 2 by 2 at (0, 0), and box b is 2 by 2 at (1, 0). Find their IoU.
- Each box has area .
- The overlap in runs from 1 to 2, a width of 1. The overlap in runs from 0 to 2, a height of 2.
- The intersection is .
- The union is .
- So .
Interpretation: the boxes are shifted by one unit and share a third of their combined area, so an IoU threshold of 0.3 would accept them as the same object, and a threshold of 0.5 would not.
A position estimate has mean 10 and variance 4. A measurement says 13, and its noise variance is 4. Compute the updated estimate.
- The gain is . The prediction and the measurement are equally uncertain, so the gain is one half.
- The innovation is the measurement minus the prediction: .
- The new mean is .
- The new variance is , which is smaller than either input. Two sources of information are better than one.
Interpretation: the filter moves halfway to the measurement, and its uncertainty drops from 4 to 2. If the measurement noise were much larger, say 36, the gain would fall to and the estimate would barely move.
Two pedestrians, P and Q, walk past each other at a crossing. Their boxes overlap in frame 5, so the IoU alone cannot say which detection is which. The tracker stores an appearance vector for each person: and . In frame 5 there are two detections, a with appearance and b with appearance . Motion gives both pairs the same cost, so only appearance decides.
- Cosine similarity of P and a: , and both vectors have length 1, so the similarity is 0.6.
- Similarity of P and b: .
- Similarity of Q and a: .
- Similarity of Q and b: .
- Two matchings are possible. P–a with Q–b has total similarity . P–b with Q–a has total . The first is larger, so the tracker assigns a to P and b to Q. Equivalently, it has the smaller total cost of , since beats .
Try it: a third detection c arrives with appearance . Compare it with a for track P. Which one does P prefer, and what does that suggest about appearance alone?
Answer: P's similarity with c is , which beats its similarity with a at . So P would prefer c, a detection that may belong to a different person. Appearance alone can mislead when two people look alike, which is why motion and appearance are combined rather than used separately.
Common mistakes and tradeoffs
It is tempting to think that tracking is just detection run on every frame. In fact a detector returns boxes with no memory of which object is which. Without an association step, each frame starts from scratch, and identities jump whenever a box is missed or relabelled.
It is tempting to think that a high IoU always means the same object. In fact two different people standing close together can have high overlap, and a fast-moving object can have almost no overlap with its own previous box. The motion prediction exists to handle the second case.
It is tempting to think that matching each detection to its best track is enough. In fact a greedy rule can let one track claim a detection that another track needed, and the total cost is worse than the optimal matching. The one-to-one constraint is the reason for the Hungarian method.
It is tempting to think that a track should be deleted as soon as it is missed. In fact occlusion, where a pedestrian walks behind a car, makes misses common, and deleting the track forces a new identity when the person reappears. Keeping missed tracks for a few frames trades a small risk of stale tracks for fewer identity switches.
When to use it: when a good detector runs on video, the objects move in a roughly predictable way, and each frame gives a reliable box. When not to use it: when the detector is weak, when the camera itself moves quickly, or when objects are so similar that appearance cannot separate them. Alternatives: joint models that detect and track in one network, and optical-flow methods that follow pixels rather than boxes.
History
Rudolf Kálmán published his filter in 1960 as a recursive way to estimate a changing quantity from noisy measurements, and it became a standard tool for guidance and navigation. Its use for tracking several targets grew from the 1970s, when researchers such as Donald Reid worked on algorithms that kept many hypotheses about which measurement belonged to which target.
The matching step has an older root. The Hungarian method for the assignment problem was published by Harold Kuhn in 1955, based on earlier work by Hungarian mathematicians, and James Munkres later gave a clearer account of it.
Tracking by detection became practical for video once accurate learned detectors existed. The 2016 SORT paper showed that a Kalman filter, a box-overlap cost and the Hungarian method together give a strong, fast baseline, and most later trackers build on that recipe.
Recap
- Multi-object tracking gives each detection the identity of the track it continues, across frames.
- Each track predicts its next box with a Kalman Filter, then the predictions are compared with the detections using Intersection over Union.
- Pairs above a threshold are gated, and the best one-to-one set is found with Bipartite Matching.
- Matched tracks are updated, unmatched detections start new tracks, and unmatched tracks survive a few misses.
- Read next: Cosine Similarity for appearance matching, and Non-Maximum Suppression for how the detector's boxes are cleaned before tracking.
Check yourself
QuestionRecall: why does the tracker need a prediction step at all, if it already has a detection in every frame?Show answer
A detection has no identity, so the tracker must decide which detection belongs to which track. The prediction gives each track an expected position, and that expected position is compared with the detections. Without it, a fast object could have no overlap with its previous box, and the tracker would lose it.
QuestionCompute: a box a of size 4 by 4 sits at (0, 0) and a box b of size 4 by 4 sits at (2, 0). What is their IoU?Show answer
Each box has area 16. The overlap in runs from 2 to 4, a width of 2, and in the overlap is the full height of 4. So the intersection is . The union is . The IoU is .
QuestionWhy: why is the one-to-one constraint needed when matching tracks to detections?Show answer
A detection is one object, so it can continue only one track, and a track can continue only one detection in a frame. Without the constraint, two tracks could claim the same box, which would give two identities to one object. The constraint also turns the matching into the assignment problem, which has an exact best solution.
QuestionApplied: a camera tracks cyclists on a busy path, and the tracker often swaps two cyclists who ride side by side for a few seconds. Motion and appearance costs are both used. Which change is most likely to help, and why?Show answer
The swap happens when motion is ambiguous and the appearance cue is weak, so the pair of cyclists looks alike to the tracker. A useful change is to give appearance more weight when the motion costs of several pairs are close, or to use a stronger appearance model that separates clothing or body shape. Lengthening the time a track survives a miss would not fix the swap, because the swap happens while both are visible.
Sources
- Wikipedia, Kalman filter
- Wikipedia, Hungarian algorithm
- Bewley, Ge, Ott, Ramos and Upcroft, "Simple Online and Realtime Tracking", arXiv:1602.00763, 2016.