Paper · 2021-04-01 · cs.CV
TransMOT: Spatial-Temporal Graph Transformer for Multiple Object Tracking
TransMOT tracks many objects by encoding tracklets and new detections as sparse IoU-weighted graphs, with graph-transformer encoder and decoder layers, a temporal transformer, and a three-stage cascade association. Author-reported: IDF1 75.1 and MOTA 76.7 on MOT17 private, IDF1 75.2 and MOTA 77.5 on MOT20 private.
Graph transformerTracking by detectionSelf-attentionmulti-object-trackinggraph-transformerdata-association
AI-compiled by claude-haiku-5-5 on 2026-11-06, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.
In plain words
Following people or cars through a video means deciding, frame after frame, which new detection belongs to which track already in progress. Earlier transformer-based trackers treated every track and every detection as one long list and let attention compare them all. That works poorly when a scene holds many objects, and it is costly.
TransMOT instead arranges the tracks and the new detections as graphs, where two objects are linked only if their boxes overlap, and the link is weighted by how much they overlap. Attention then runs mostly along those links, first within each frame and then across the recent frames for each track. A matching step produces a table of which detection continues which track, or starts a new one, or ends. A separate cascade stage handles the easy cases first, such as confident detections, and the cases where an object was hidden for a while.
The result is a tracker that the authors report as more accurate and cheaper to run than a plain transformer over the same objects, evaluated on the MOT15, MOT16, MOT17 and MOT20 pedestrian benchmarks.
TL;DR
- Online multi-object tracker: each frame, the current tracks are matched to new detections §3.
- Core idea: tracks and detections are sparse IoU-weighted graphs; a graph transformer encoder, a temporal transformer encoder and a graph transformer decoder produce an assignment matrix §4.
- A three-stage cascade (Kalman-based motion matching, transformer association, occlusion and duplicate handling) sits around the model §4.4.
- Author-reported state of the art on the MOT15, MOT16, MOT17 and MOT20 test sets; the paper's own comparison is against the methods in Tables 1 to 4 §5.2.
- Reimplementation risk is high: the loss has a sign question, and several cascade thresholds are not stated (see Pitfalls).
Problem
Tracking-by-detection needs a model that links the existing tracks to the detections in each frame §1. The authors argue that a general transformer over all objects of a video (a) ignores the spatial structure of the scene, (b) needs much data and computation to learn long temporal dependencies, and (c) builds on a DETR-based detector that is not state of the art for MOT §1. The model is meant for online tracking with a fixed number of past frames, so tracks that were occluded for longer than that window are not handled by the model itself [§3, §4.4].
Method
Notation. Let the tracked set at frame t-1 have N tracklets, each with
states over the last T frames, and let frame t have M candidate detections
§3. The model outputs an extended assignment matrix Abar of size
(M+1) x (N+1). The extra row is a virtual sink (a track that exits or is
occluded), and the extra column is a virtual source (a detection that starts a
new track) §4.2 §4.3.
Assignment objective. The association is first written as a constrained
maximisation of pairwise affinities, with one-to-one constraints on rows and
columns eq. 1 eq. 2. The model replaces this with a single mapping
Abar = Phi(tracklets, candidates) §3. During training, the one-to-one
constraint is relaxed so that each detection goes to exactly one track or the
virtual source, while a track may take several detections; each row then is a
distribution over N+1 options §4.3.
Step 1. Tracklet graphs §4.1 fig. 2. For each of the last T frames, the
tracklets form a graph. Nodes are tracklet states, an edge exists if the two
boxes have IoU greater than zero, and the edge weight is that IoU. The node
features are a learned linear embedding into D dimensions §4.1. The paper's
node feature is the visual feature (SiamFC) concatenated with normalised box
coordinates §5.1.
Step 2. Spatial graph transformer encoder layer §4.1.1 eq. 3. Multi-head graph attention runs
independently for each frame. The attention weights of head i are the scaled
dot-product scores multiplied element-wise by the graph weights, then passed
through a softmax eq. 3. The values come from a graph convolution over the
node features rather than a linear map §4.1.1. Heads are concatenated and
projected by an output matrix W^O, then followed by a linear feed-forward layer
and a normalisation layer §4.1.1. The paper uses 8 heads and one layer of
ChebConv with neighbourhood distance 2 §5.1.
Step 3. Temporal transformer encoder layer §4.1.2. The output of step 2 is
re-ordered from frame-major to tracklet-major, so that each tracklet gets a
sequence of T frame embeddings. A standard transformer encoder then attends
over time, separately for each tracklet. Its output is the encoder output
F_out^en §4.1.2.
Step 4. Candidate graph and sink §4.2 fig. 3. The M candidates form a
graph built the same way as in step 1 (edges where IoU is above zero, weight
equal to IoU). A learnable sink embedding f_snk is added as one more node, and
it is connected to every other node with fixed weight 0.5 §4.2.
Step 5. Graph decoder §4.2. The candidate node features (now M+1 nodes)
pass through graph multi-head attention, the same kind as in step 2. The result
is copied N+1 times so that each candidate can be compared with each tracklet
and with the virtual source. A learnable embedding serves as the virtual source
and is appended to the tracklet embedding, so the tracklet side has N+1 entries
§4.2. Multi-head cross attention is computed between these two sides, followed
by a feed-forward and normalisation layer §4.2. The paper uses one virtual
source, not several as in earlier transformer trackers, because it performed
about as well and was cheaper §4.2.
Step 6. Assignment output §4.2. A linear layer and a softmax turn the
decoder output into Abar of size (M+1) x (N+1).
Step 7. Cascade association at inference §4.4 fig. 4. Three stages:
- Motion matching for confident tracks. A Kalman filter predicts boxes for
tracks that were matched in each of the last
K_rframes. Predicted and candidate boxes are matched with the Hungarian algorithm by IoU. Pairs with IoU abovetau_Mare accepted. Low-confidence candidates that stay unmatched are removed §4.4. - TransMOT association. The model runs on the remaining tracks and candidates.
The block of
Abarthat links real tracks to real candidates is soft, so a bipartite matching is applied to it. Only matches whose score exceeds a threshold are kept §4.4. The paper does not name the matching algorithm here. - Long-term occlusion and duplicates. Tracks that were occluded for more than
Tframes (outside the model's window) are matched by a cost that adds the Euclidean distance between stored visual features and a normalised top-distanceD_topbetween the last visible box and the candidate §4.4 [the formula forD_topis unnumbered in the paper]. Candidates that lie inside an already matched box are removed as duplicates, using intersection over the candidate's own area as the cost §4.4. Remaining candidates start new tracks. Tracks not updated for more thanK_pframes are removed; tracks not updated for fewer frames are marked "occluded" §4.4.
Training objective §4.3 eq. 4. The loss has three parts: (i) cross-entropy
on the detection rows, (ii) a sink term for the sink row, and (iii) a sink term
for the non-sink entries. Terms (ii) and (iii) are weighted by lambda, whose
value is not stated §4.3. Training uses random windows of T+1 consecutive
frames §4.3. Ground-truth boxes are swapped for detector boxes that match them
by IoU, so the model sees detector noise §4.3. Detector IDs are remapped to the
{0, ..., N} index space, where a detection either matches a tracklet or the
virtual source §4.3.
Formula, eq. 4 as typeset eq. 4:
L = -1/M * sum_m y_m log(abar_m)
+ lambda/N * sum_n y_n^snk log(1 / (1 + exp(-a'_n)))
+ lambda/N * sum_n (1 - y_n^snk) log(exp(-a'_n) / (1 + exp(-a'_n)))where y_m is the index of the target column for detection m, abar_m is row
m of Abar, y_n^snk flags whether tracklet n is the sink target, and
a'_n is the sink logit for tracklet n §4.3.
Pseudocode
The following sketches the encoder, the decoder and the loss, written from the text and the equations above. Names are ours; shapes follow the paper's tensor notation.
# Spatial-temporal encoder over tracklet graphs [§4.1] [eq. 3]
# Input: tracklet_feats (N, T, D0), iou (T, N, N) sparse
# Output: encoded (N, T, D), D = 1024 [§5.1]
def encode_tracklets(tracklet_feats, iou):
# Linear embedding of each node, independently [§4.1]
embedded = linear_embed(tracklet_feats) # (N, T, D)
spatial = []
# Spatial graph attention, one graph per frame [§4.1.1] [eq. 3]
for t in range(T):
# 8 heads, concatenated and projected by W^O [§5.1] [§4.1.1]
scores = scaled_dot(embedded[:, t], embedded[:, t])
# Element-wise product with IoU weights, then softmax [eq. 3]
attention = softmax(scores * iou[t])
# Graph convolution gives the value features [§4.1.1] [§5.1]
values = graph_conv(embedded[:, t], iou[t])
spatial.append(attention @ values)
spatial = stack(spatial, axis=1) # (N, T, D)
# Feed-forward and normalisation; sizes not stated [§4.1.1]
spatial = feed_forward_and_norm(spatial)
# Temporal encoder over T for each tracklet [§4.1.2]
ordered = transpose(spatial, 0, 1) # (T, N, D)
temporal = temporal_transformer(ordered) # over T, per track
return transpose(temporal, 0, 1) # (N, T, D)# Candidate decoder and assignment matrix [§4.2]
# Input: candidates (M, D0), candidate_iou (M, M), encoded (N, T, D)
# Output: assignment (M+1, N+1), each row sums to 1 (softmax over columns)
def decode_assignment(candidates, candidate_iou, encoded):
# Embed candidates, then add the learnable sink node [§4.2]
nodes = concat(linear_embed(candidates), learned_sink) # (M+1, D)
# Sink connected to all nodes with weight 0.5 [§4.2]
graph_weights = add_sink_edges(candidate_iou, sink_weight=0.5)
# Graph multi-head attention over candidates [§4.2]
attended = graph_attention(nodes, graph_weights) # (M+1, D)
# Learnable virtual source appended on the tracklet side [§4.2]
tracklets = concat(encoded_flat, learned_source) # (N+1, ..., D)
# Duplicate candidates over N+1 columns, then cross attention [§4.2]
queries = repeat(attended, times=N + 1, axis=1) # (M+1, N+1, D)
cross = cross_attention(queries, tracklets)
cross = feed_forward_and_norm(cross)
# Linear layer and softmax over the N+1 columns [§4.2]
logits = linear_out(cross) # (M+1, N+1)
return softmax(logits, axis=1)# Training loss [§4.3] [eq. 4], as typeset
# Inputs: assignment (M+1, N+1), target_cols (M,) index into N+1 columns,
# sink_flags (N,) in {0, 1}, sink_logits (N,)
# lam: weight, value not stated [§4.3]
def training_loss(assignment, target_cols, sink_flags, sink_logits, lam):
# Cross-entropy over the detection rows [§4.3] [eq. 4, term 1]
row_probs = assignment[:M][range(M), target_cols]
detection_term = -mean(log(row_probs))
# Sink term for tracklets flagged as sink [eq. 4, term 2]
sink_pos = lam * mean(sink_flags * log(sigmoid(sink_logits)))
# Sink term for the remaining tracklets [eq. 4, term 3]
sink_neg = lam * mean((1 - sink_flags) * log(1 - sigmoid(sink_logits)))
# Signs as typeset; see Pitfalls before using [§4.3]
return detection_term + sink_pos + sink_negHyperparameters
| Name | Value | Where | Notes |
|---|---|---|---|
tracklet history T | 5 | §5.1 | default; T=1, 10, 20 in ablation §5.3 tab. 5 |
embedding dimension D | 1024 | §5.1 | |
| attention heads | 8 | §5.1 | all heads in spatial and temporal layers |
| graph convolution | 1 ChebConv layer, neighbour distance 2 | §5.1 | ChebConv from [defferrard2016convolutional] |
| optimiser | vanilla SGD | §5.1 | |
| initial learning rate | 0.0015 | §5.1 | schedule not stated |
| batch size | not stated | ||
| number of epochs (TransMOT) | not stated | ||
| weight decay, momentum | not stated | ||
loss weight lambda | not stated | §4.3 | |
| sink edge weight | 0.5 | §4.2 | fixed |
| number of encoder / decoder layers | not stated | not given in the text §4.1 §4.2 | |
| feed-forward width, normalisation type | not stated | ||
| Kalman filter parameters | not stated | §4.4 | |
motion-match IoU threshold tau_M | 0.75 | §5.1 | inference |
robust-track history K_r | 15 | §5.1 | frames |
unseen-track removal K_p | 50 | §5.1 | frames |
| stage-2 assignment threshold | not stated | §4.4 | |
| stage-1 low-confidence threshold | not stated | §4.4 | |
| stage-3 matching threshold | not stated | §4.4 | |
| max input width | 1920 | §5.1 | ablation at 1280 §5.3 |
| training window | T+1 frames | §4.3 | random consecutive frames |
| detector | YOLOv5, 407 layers, 300 epochs | §5.1 | trained on CrowdHuman and MOT17/MOT20 training sets |
| visual features | SiamFC, pretrained on ILSVRC15 | §5.1 | |
| training set for TransMOT | the dataset of [lin2020human] | §5.1 | |
| hardware | 10-core CPU at 3.60 GHz, 1 NVIDIA Tesla V100 | §5.1 | |
| speed | detector 15.4 fps; TransMOT + features 24.5 fps; full pipeline 9.6 fps | §5.1 | author-reported |
For the ablation, the detector was trained on CrowdHuman only §5.3, so ablation numbers are not comparable with Tables 3 and 4.
Results
Author-reported, on the MOT challenge test sets. Metrics: IDF1, MOTA, MT (mostly tracked, higher is better), ML (mostly lost, lower is better), FP, FN and IDS (identity switches, lower is better). Baseline rows are as listed in the cited tables; bold marks the best entry per column, as the source's bolding intends.
MOT15, private detection track tab. 1
| Method | IDF1 | MOTA | MT | ML | FP | FN | IDS |
|---|---|---|---|---|---|---|---|
| DMT | 49.2 | 44.5 | 34.7% | 22.1% | 8,088 | 25,335 | 684 |
| TubeTK | 53.1 | 58.4 | 39.3% | 18.0% | 5,756 | 18,961 | 854 |
| CDADDAL | 54.1 | 51.3 | 36.3% | 22.2% | 7,110 | 22,271 | 544 |
| TRID | 61.0 | 55.7 | 40.6% | 25.8% | 6,273 | 20,611 | 351 |
| RAR15 | 61.3 | 56.5 | 45.1% | 14.6% | 9,386 | 16,921 | 428 |
| GSDT | 64.6 | 60.7 | 47.0% | 10.5% | 7,334 | 16,358 | 477 |
| Fair | 64.7 | 60.6 | 47.6% | 11.0% | 7,854 | 15,785 | 591 |
| TransMOT | 66.0 | 57.0 | 64.5% | 17.8% | 12,454 | 13,725 | 244 |
MOT16, private detection track tab. 2
| Method | IDF1 | MOTA | MT | ML | FP | FN | IDS |
|---|---|---|---|---|---|---|---|
| IoU | 46.9 | 57.1 | 23.6% | 32.9% | 5,702 | 70,278 | 2,167 |
| CTracker | 57.2 | 67.6 | 32.9% | 23.1% | 8,934 | 48,305 | 1,897 |
| LMCNN | 61.2 | 67.4 | 38.2% | 19.2% | 10,109 | 48,435 | 931 |
| DeepSort | 62.2 | 61.4 | 32.8% | 18.2% | 12,852 | 56,668 | 781 |
| FUFET | 68.6 | 76.5 | 52.8% | 12.3% | 12,878 | 28,982 | 1,026 |
| LMP | 70.1 | 71.0 | 46.9% | 21.9% | 7,880 | 44,564 | 434 |
| CSTrack | 73.3 | 75.6 | 42.8% | 16.5% | 9,646 | 33,777 | 1,121 |
| TransMOT | 76.8 | 76.7 | 56.5% | 19.2% | 14,999 | 26,967 | 517 |
MOT17, public and private detection tracks tab. 3
| Method | IDF1 | MOTA | MT | ML | FP | FN | IDS |
|---|---|---|---|---|---|---|---|
| Public | |||||||
| TrctrD | 53.8 | 53.7 | 19.4% | 36.6% | 11,731 | 247,447 | 1,947 |
| Tracktor | 55.1 | 56.3 | 21.1% | 35.3% | 8,866 | 235,449 | 1,987 |
| CTTrack | 59.6 | 61.5 | 26.4% | 31.9% | 14,076 | 200,672 | 2,583 |
| TrackFormer | 59.8 | 61.8 | 35.4% | 21.1% | 35,226 | 177,270 | 2,982 |
| MPNTrack | 61.7 | 58.8 | 28.8% | 33.5% | 17,413 | 213,594 | 1,185 |
| LifT | 65.6 | 60.5 | 27.0% | 33.6% | 14,966 | 206,619 | 1,189 |
| MAT | 69.2 | 67.1 | 38.9% | 26.4% | 22,756 | 161,547 | 1,279 |
| TransMOT-P | 72.2 | 68.7 | 33.5% | 31.0% | 8,078 | 167,602 | 1,014 |
| Private | |||||||
| DAN | 49.5 | 52.4 | 21.4% | 30.7% | 25,423 | 234,592 | 8,431 |
| TransTrack | 56.9 | 65.8 | 32.2% | 21.8% | 24,000 | 163,683 | 5,355 |
| TubeTK | 58.6 | 63.0 | 31.2% | 19.9% | 27,060 | 177,483 | 5,727 |
| CTTrack | 64.7 | 67.8 | 34.6% | 24.6% | 18,498 | 160,332 | 6,102 |
| Fair | 72.3 | 73.7 | 43.2% | 17.3% | 27,507 | 117,477 | 8,073 |
| TransMOT-D | 66.9 | 68.8 | 35.8% | 31.7% | 26,670 | 147,690 | 1,797 |
| TransMOT | 75.1 | 76.7 | 51.0% | 16.4% | 36,231 | 93,150 | 2,346 |
MOT20, public and private detection tracks tab. 4
| Method | IDF1 | MOTA | MT | ML | FP | FN | IDS |
|---|---|---|---|---|---|---|---|
| Public | |||||||
| SORT* | 45.1 | 42.7 | 16.7% | 26.2% | 27,521 | 264,694 | 4,470 |
| Tracktor | 52.7 | 52.6 | 29.4% | 26.7% | 6,930 | 236,680 | 1,648 |
| MPNTrack | 59.1 | 57.6 | 38.2% | 22.5% | 16,953 | 201,384 | 1,210 |
| LPCMOT | 62.5 | 56.3 | 34.1% | 25.2% | 11,726 | 213,056 | 1,562 |
| TransMOT-P | 74.3 | 73.1 | 54.3% | 14.6% | 12,366 | 125,665 | 1,042 |
| Private | |||||||
| MLT | 54.6 | 48.9 | 30.9% | 22.1% | 45,660 | 216,803 | 2,187 |
| GSDT | 67.5 | 67.1 | 53.1% | 13.2% | 31,913 | 135,409 | 3,131 |
| Fair | 67.3 | 61.8 | 68.8% | 7.6% | 103,440 | 88,901 | 5,243 |
| CSTrack | 68.6 | 66.6 | 50.4% | 15.5% | 25,404 | 144,358 | 3,196 |
| TransMOT | 75.2 | 77.5 | 70.7% | 9.1% | 34,201 | 80,788 | 1,615 |
* SORT is run without the public-detection filter tab. 4 caption.
MOT17 and MOT20 private, as quoted in the text: TransMOT-D is 10.0 points above TransTrack in IDF1 and 3.0 points above it in MOTA §5.2. On MOT20 the private TransMOT is 6.6 points above CSTrack in IDF1 §5.2. Moving from the private to the public setting on MOT20, MOTA drops by 4.4 points and IDF1 by 0.9 §5.2.
Ablation on the MOT17 training set, detector trained on CrowdHuman only [tab. 5] §5.3:
| Configuration | IDF1 | MOTA | FPS |
|---|---|---|---|
| TransMOT without motion matching (MwM) | 76.0 | 73.6 | 9.2 |
| TransMOT without long-term occlusion handling (LTOH) | 76.5 | 74.6 | 7.8 |
| TransMOT at max width 1280 | 75.3 | 72.9 | 13.8 |
T = 1 | 77.8 | 74.7 | 9.8 |
T = 10 | 78.0 | 74.8 | 9.3 |
T = 20 | 77.8 | 74.7 | 8.5 |
| with DGNet features | 77.5 | 74.7 | 6.0 |
| with colour histogram features | 77.5 | 74.9 | 12.3 |
| with SiamFC features (default) | 78.1 | 74.8 | 9.6 |
Qualitative results are shown in fig. 5 (sequences from MOT15, 16, 17, 20).
Paper vs code
No official code. Searches: the arXiv abstract page (no code link); a GitHub
repository search for "TransMOT" (results were unrelated projects with similar
names); "TransMOT multiple object tracking" (no results); "TransMOT" limited to
the microsoft organisation (no results); and "transmot tracking" (no results).
The LaTeX source has no repository URL.
Pitfalls
- Loss sign (eq. 4). As typeset, only the first term carries a leading minus. The two sink terms are written as log-probabilities with a plus, so the sum as printed is not a loss to minimise. The paper does not say whether the sink terms are meant to be negated. The LaTeX source contains a commented-out author note asking whether the minus on the sink term should be removed (source line 282; this note is not in the published text). Decide the sign by a sanity check on a toy case, and document the choice.
- Sparsity claim vs equation. The paper says the graph weights make attention
non-zero only for interacting tracklets §4.1.1. Eq. 3 multiplies the scores
by the weights before the softmax. For a pair with zero IoU the score becomes
zero, which is not
-inf, so such a pair still gets softmax mass unless the implementation masks it. The paper does not state the masking. Check the code before assuming sparsity. - Decoder tensor shapes. The text gives shapes
(M+1)x1xD,(M+1)x(N+1)xDandTx(N+1)xDbut does not say how theTaxis of the tracklet embedding enters the cross attention §4.2. Choose a pooling or attend-over-T scheme and document it. - Relaxed assignment. Training allows one track to receive several detections. Inference then needs a second matching step (stage 2 in §4.4), whose algorithm is not named there and whose threshold is not stated.
- Virtual sink targets. The sink row is trained as a multi-label target, but
how
y_n^snkis derived from ground truth (exit versus occlusion) is not stated §4.3. - Unstated thresholds. Stage 1 and stage 2 thresholds, the stage 3 cost
weighting between feature distance and
D_top, the duplicate-removal threshold, and the Kalman parameters are not stated §4.4. - Hidden costs. The full tracker runs at 9.6 fps, with the detector alone at 15.4 fps §5.1. The detector is a YOLOv5 variant trained for 300 epochs on CrowdHuman plus MOT training sets; those training costs are not included in the reported speed §5.1.
- Ablation vs main results. Ablations use a CrowdHuman-only detector and the MOT17 training set §5.3. Their numbers are not comparable with the test-set tables.
- "State of the art on all datasets". The abstract claims it, but on MOT15 the text claims SOTA only for IDF1, MT, FN and IDS §5.2; in Table 1 GSDT has higher MOTA. The text attributes low MOTA on MOT15 to incomplete annotation §5.2.
- Typos in the text. Section 5.3 writes
Lwhere it meansT("increasingLbeyond 5"). UseT. - Unnumbered formulas. The
D_topformula and the multi-head output formula in §4.1 and §4.4 carry no equation number; cite by section.
Lineage
- Builds on: the Transformer attention mechanism §4.1 (cited as the scaled dot-product of Vaswani et al.), the ChebConv graph convolution §5.1, and the graph-based MOT tradition of multi-cut and lifted-edge formulations §2.
- Compared against: TransTrack and TrackFormer, the transformer-based MOT trackers of the same period §2 tab. 3; the graph-based MPNTrack and LifT tab. 3; and the detection-based trackers in Tables 1 to 4.
- Superseded by: not stated in this wiki.
Source and license
Adapted from “TransMOT: Spatial-Temporal Graph Transformer for Multiple Object Tracking” by Peng Chu, Jiang Wang, Quanzeng You, Haibin Ling, Zicheng Liu (arXiv:2104.00194), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors.