Skip to content

Video understanding, tracking, generation, and world models · Motion and tracking · VID034 · Algorithm

Simple Online and Realtime Tracking (SORT)

Maintains multiple object tracks using detector boxes, a motion model and assignment between predicted tracks and new detections. SORT itself is not a deep model; its detector often is.

Runs in CodeSplash (Experimental) Component demo, not a trained model CodeSplash's run and the reference's record

In CodeSplash

A CodeSplash method runs this entry in Python and R. Set it up from the method's page. The methods that run it are Experimental.

Do it in CodeSplash Run it on your own data. It's in the Experimental lane in the app.

Availability
Runs in CodeSplash (Experimental)
Code example
Component demo, not a trained model
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
Verified in Python and R through track.objects. The reference's example ran here in one language.
The reference's record
Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Maintains multiple object tracks using detector boxes, a motion model and assignment between predicted tracks and new detections. SORT itself is not a deep model; its detector often is. It is an essential baseline for separating detection quality from association quality.

Question / objective

Estimate image displacement or maintain the location and identity of objects/points over time. This is a learning or inference objective, not a test of a statistical null hypothesis.

Method type and supervision

algorithm · Motion and tracking. Mixed: supervised neural perception or non-neural inference over detections; see the individual assumptions.

Architecture / computational structure

Kalman state estimator, IoU association cost, assignment solver and track lifecycle.

Assumptions

Inputs must satisfy the temporal, modality and annotation protocol described below. Constant-velocity approximations fail under abrupt motion; appearance is absent, so crossings and prolonged occlusions cause identity switches. Unmatched handling is part of the algorithm.

Formula / computational definition

x^t=Fx^t−1\hat x_t=F\hat x_{t-1} predicts state, and min⁡π∑i[1−IoU⁡(bi,dπ(i))]\min_\pi\sum_i[1-\operatorname{IoU}(b_i, d_{\pi(i)})] assigns detections to predicted boxes. A Kalman filter updates the state and uncertainty after matching.

Parameters and notation

Learned/estimated quantities: The association algorithm has no learned neural weights. Track states and uncertainties are updated online; detector weights, if present, belong to the external detector. Noise matrices, gates and lifecycle limits are tuned design choices. Symbols specific to the objective are defined with the equation. Hyperparameters and design choices: IoU gating, track age, initialization hits, state/noise matrices and detector thresholds matter.

Fitting, fine-tuning, and adaptation

No neural fine-tuning exists inside SORT. Tune motion/process noise, gates and track lifetime on validation sequences; detector training is a separate component. Use a separate adaptation validation split, monitor the target metric and retention of previously useful behavior, and save the exact preprocessing and training configuration.

How to use and calibrate

Fix the input protocol and target before fitting; choose design settings on held-out source videos, then freeze the evaluation procedure. Report detection and association metrics, including ID switches or HOTA/IDF1 as appropriate, with a fixed detector.

Example application

Maintain vehicle IDs using only boxes and motion.

Interpretation / pitfalls

Watch out

An optimized training objective or a favorable example does not establish generalization. Report detection and association metrics, including ID switches or HOTA/IDF1 as appropriate, with a fixed detector. The example below isolates one mechanism and cannot substantiate a full-model benchmark claim.

Python and R code examples

Component: Solve a tiny geometric assignment exhaustively. Dependencies: NumPy in Python; base R in R; run the shared setup above. Python component: executed successfully. R component: unexecuted. No complete model training or pretrained inference was executed.

Full implementation route — Python: Implement Kalman filtering plus SciPy linear assignment; account explicitly for unmatched tracks and detections. R: Use matrix-based Kalman updates and an assignment solver in R; the small educational example uses exhaustive permutations only.

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Component demo, not a trained model — Solve a tiny geometric assignment exhaustively.

Shared setup for this chapter
import numpy as np

def softmax(x):
    z = np.asarray(x, dtype=float)
    e = np.exp(z - z.max())
    return e / e.sum()
import itertools
cost = np.array([[.1,.9],[.8,.2]])  # illustrative 1-IoU costs
assignment = min(itertools.permutations(range(2)),key=lambda p:sum(cost[i,p[i]] for i in range(2)))
print(assignment,"cost",sum(cost[i,assignment[i]] for i in range(2)))
# Use a linear-assignment solver and gating for real trackers.
R

Component demo, not a trained model — Solve a tiny geometric assignment exhaustively.

Shared setup for this chapter
softmax <- function(x) {
  e <- exp(x - max(x))
  e / sum(e)
}
cost <- rbind(c(.1,.9),c(.8,.2))
assignments <- rbind(c(1,2),c(2,1))
totals <- apply(assignments,1,function(p)sum(cost[cbind(1:2,p)]))
print(assignments[which.min(totals),]); print(min(totals))
# Exhaustive search is suitable only for this two-object illustration.

Sources

From the CodeSplash reference, entry VID034.