DeepSORT (Deep Simple Online and Realtime Tracking) is a multi-object tracking algorithm that assigns persistent identities to detected objects across video frames by combining Kalman filter motion prediction with deep appearance embeddings. Computer vision teams use it as a classic tracking-by-detection baseline: an object detector finds objects in each frame, and DeepSORT decides which detection belongs to which existing track.
Published in 2017 as an extension of the original SORT tracker, DeepSORT added a re-identification network that describes how each object looks. This single change sharply reduced identity switches, the errors in which a tracker swaps the labels of two people or vehicles, and made the method a standard component in surveillance, retail analytics and traffic monitoring pipelines.
How DeepSORT links detections into tracks
DeepSORT works online, meaning it processes each frame once and never revisits earlier frames. For every frame it receives a set of bounding boxes from a detector such as YOLO or Faster R-CNN, predicts where each existing track should be, and solves an assignment problem that pairs predictions with new detections.
Each track carries an eight-dimensional state: the box center, aspect ratio, height and their velocities. A constant-velocity Kalman filter propagates this state forward and also produces a covariance, which expresses how uncertain the prediction is. Uncertainty grows every frame a track goes unmatched.
The following table summarizes the main stages that run on every frame.
| Stage | What happens | Output |
|---|---|---|
| Detection | An external detector proposes boxes with confidence scores | Filtered boxes |
| Feature extraction | A small CNN embeds each box crop into a 128-dimensional vector | Appearance descriptors |
| Prediction | The Kalman filter projects every track to the current frame | Predicted boxes and covariance |
| Matching cascade | Tracks are matched by recency using combined motion and appearance cost | Confirmed pairs |
| IoU fallback | Remaining young tracks are matched by box overlap | Additional pairs |
| Track management | New tracks start, unmatched tracks age and are deleted | Updated track list |
The association metric and matching cascade
The core of DeepSORT is its combined association cost. The motion term is the Mahalanobis distance between a detection and a predicted track, which accounts for the uncertainty of the Kalman estimate. The appearance term is the smallest cosine distance between the new embedding and a gallery of up to 100 stored embeddings per track.
Both terms act as gates: a pair is admissible only if the Mahalanobis distance stays below the chi-square 95 percent threshold (about 9.49 for four degrees of freedom) and the cosine distance stays below a tuned limit. In the original configuration the final cost relies almost entirely on appearance, while motion mainly rules out physically implausible matches.
The matching cascade gives priority to tracks that were seen most recently. Tracks unmatched for one frame are assigned first, then those missing for two frames, and so on. This ordering prevents an old, highly uncertain track from stealing a detection that clearly belongs to a fresh one. The Hungarian algorithm solves each assignment step optimally.
The key parameters below control how forgiving the tracker is.
| Parameter | Typical value | Effect when increased |
|---|---|---|
| max_age | 30 frames | Tracks survive longer occlusions but ghost tracks linger |
| n_init | 3 frames | Fewer false tracks but slower confirmation |
| max_cosine_distance | 0.2 to 0.4 | More appearance matches and more wrong merges |
| nn_budget | 100 embeddings | Better memory of appearance at higher cost |
| max_iou_distance | 0.7 | Looser overlap matching for unconfirmed tracks |
DeepSORT compared with other trackers
DeepSORT sits between purely geometric trackers and modern joint detection and tracking models. Its main advantage over SORT is robustness to occlusion, because appearance features allow a track to be recovered after the object has been hidden for dozens of frames.
| Method | Association cue | Main strength | Main weakness |
|---|---|---|---|
| SORT | IoU with Kalman prediction | Very fast and simple | Frequent identity switches |
| DeepSORT | Motion gate plus appearance embedding | Recovers objects after occlusion | Extra network cost per box |
| ByteTrack | IoU including low-score boxes | High recall in crowds | No appearance memory by default |
| StrongSORT | Improved embeddings and camera motion compensation | Higher accuracy on benchmarks | Heavier pipeline |
| FairMOT | Detection and embedding from one network | Single-pass efficiency | Harder to swap detectors |
In benchmark terms, DeepSORT is usually evaluated on the MOT16 and MOT17 datasets with metrics such as MOTA, IDF1 and HOTA. Newer trackers report higher scores, yet DeepSORT remains widely deployed because it is modular, well understood and easy to tune.
Deploying DeepSORT in practice
Tracking quality depends first on the detector, since DeepSORT cannot track what is never detected. A practical rule is to tune the detection confidence threshold together with tracker settings rather than separately, because missed detections and false positives propagate directly into broken or spurious tracks.
The re-identification model should match the target domain. The original network was trained on a pedestrian dataset, so vehicles, animals or products need a retrained embedding network. Running this network on every box adds latency that scales with the number of objects, which matters on edge devices.
| Situation | Recommended adjustment | Reason |
|---|---|---|
| Dense crowds | Lower max_cosine_distance | Reduces merges between similar people |
| Long occlusions | Raise max_age | Keeps identities alive behind obstacles |
| Moving camera | Add camera motion compensation | The Kalman model assumes a static view |
| Low frame rate | Rely more on appearance | Motion predictions become unreliable |
| Limited compute | Batch crops and use a lighter embedder | Cuts per-object latency |
Limitations and common failure modes
DeepSORT inherits several structural limitations from its design. Experienced practitioners watch for the following problems:
- Linear motion assumption: sudden turns or camera shake break the constant-velocity model.
- Similar appearance: people in uniforms or identical vehicles defeat the embedding and cause swaps.
- Per-box cost: compute grows linearly with the number of objects in the scene.
- No global optimization: as an online method it cannot correct earlier mistakes using future frames.
- Single-camera scope: tracking across cameras requires a separate re-identification system.
A frequent misconception is that DeepSORT itself detects objects. It is strictly an association layer, and its results should always be reported together with the detector that feeds it.
Put simply
Imagine watching a busy train station on video. A detector can spot every person in each frame. But it does not know that the person in one frame is the same person a moment later. DeepSORT solves that problem.
It does two things at once. It guesses where each person will move next, like predicting where a rolling ball will go. It also remembers what each person looks like, such as a red coat or a backpack. When someone walks behind a pillar and reappears, DeepSORT can recognize them and keep the same label. The result is a steady number attached to each person for as long as they stay in view.
In practice
A city transport department wants to count how many cyclists cross a busy intersection and how long they wait at red lights. Engineers mount a fixed camera recording at 25 frames per second and run a YOLO detector on a roadside edge computer. DeepSORT links the detections, with max_age set to 50 frames so cyclists hidden briefly behind buses keep their identities.
Because the default embedding network was trained on pedestrians, the team fine-tunes it on a few thousand labeled cyclist crops from their own footage. After this change, identity switches during bus occlusions drop noticeably in a manually checked sample. The department obtains reliable per-cyclist waiting times and uses them to adjust signal timing at peak hours.