Sub topic 4
The Tracking-by-Detection Pipeline
Assume you know basic Python and NumPy, bounding boxes from object detection, vectors and matrices, and the idea of a Gaussian distribution. This chapter explains the working pipeline that turns independent detections into persistent object tracks.
What “tracking by detection” means
An object detector examines each video frame separately. It returns objects such as people or cars, along with a bounding box, class label, and confidence score. The detector does not normally know whether a person in frame 12 is the same person seen in frame 11.
A tracker connects these frame-level results over time. It maintains a track, which is the current state of one possible object. A track usually stores:
- A unique track ID.
- The latest bounding box.
- The object class.
- A motion estimate.
- The number of successful matches.
- The number of consecutive missed detections.
The tracker does not need to detect every object itself. It predicts where existing objects should appear, compares those predictions with new detections, and updates the identities.
The frame-by-frame pipeline
For each frame, a tracking-by-detection system follows this sequence:
- Run the object detector.
- Filter detections by class or confidence.
- Predict the next position of every active track.
- Compare predicted tracks with current detections.
- Associate detections with tracks.
- Update matched tracks.
- Mark unmatched tracks as temporarily missing.
- Create tracks for unmatched detections.
- Remove tracks that have been missing for too long.
- Return the active tracks for drawing or downstream analysis.
The association step is the identity decision. A tracker may compare bounding-box overlap, predicted distance, appearance, or a combination of these signals.
What happens when detections are missing?
A detector can miss an object because of blur, occlusion, poor lighting, or a low confidence score. The tracker should not immediately delete the object's identity. Instead, it lets the track coast for a limited number of frames using its motion prediction.
When a later detection is close enough to the predicted position, the tracker matches it to the existing track. The track keeps its ID. If the gap lasts longer than the configured limit, the tracker deletes the track.
This creates a trade-off:
| Setting | Advantage | Risk |
|---|---|---|
| Short missing-track limit | Removes false tracks quickly | Breaks identities during brief occlusions |
| Long missing-track limit | Preserves identities through gaps | Keeps stale tracks after objects leave |
Common pipeline errors
- Treating every detection as a new object creates a new ID in every frame.
- Associating before predicting can fail when objects move between frames.
- Updating a track with two detections gives duplicate ownership unless each detection is assigned once.
- Deleting a track after one missed frame causes fragmentation.
- Using only class labels cannot distinguish two nearby objects of the same class.
The next chapters examine the main association signal, intersection over union, before implementing the assignment step.
Exercise
A person is detected in frames 1 and 2, missed in frame 3, and detected again in frame 4 near the predicted position. What should a basic tracker do?
Show answer
Keep the track during frame 3, increase its missed-frame count, and match the frame-4 detection back to the same track if it passes the association gate.