Back to paper library
arXiv 2022CVPR 2022Object trackingPaper notes

GTR

The Bigger Picture

Original paper

Global Tracking Transformers

Paper authors

Xingyi Zhou · Tianwei Yin · Vladlen Koltun · Philipp Krähenbühl

Publication
CVPR 2022Conference
First submitted to arXiv
arXiv:2203.13250
Cite this paper · BibTeX

The citation identifies the linked source version. It cites the original paper and its authors.

@misc{multiobjecttrackinggtr2022,
  title = {{Global Tracking Transformers}},
  author = {Xingyi Zhou and Tianwei Yin and Vladlen Koltun and Philipp Krähenbühl},
  year = {2022},
  eprint = {2203.13250},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2203.13250}
}
On this page

In 2020, Xingyi Zhou built CenterTrack. It feeds the previous frame's image and detections into the detector together, has the detector also predict how far each object moved, and uses that displacement to link objects across two adjacent frames.

Two years later, Zhou, together with Tianwei Yin and Philipp Krähenbühl of the University of Texas at Austin and Vladlen Koltun of Apple, asked a different question. Why does tracking have to go one frame at a time?

Original Figure 1. The top row is a local tracker, where the arrows between the four frames link the same person only across two adjacent frames; the bottom row is this paper's global tracker, where each person's detections in all four frames connect to the same point below the frames, meaning that objects across the whole clip are grouped into trajectories in one go.
Original Figure 1, Zhou et al., from PDF page 1, arXiv license, scholarly quotation.

The top row is how a local tracker works, looking at only two adjacent frames at each step. The bottom row is this paper's approach, which takes a short piece of video and decides in one go which box each object corresponds to in every frame.

Defining the problem

Tracking-by-detection splits the problem into two steps, detecting in every frame first and then linking the detection boxes across time. There are roughly two schools of linking.

Local trackers, such as SORT, DeepSORT, CenterTrack and FairMOT, all do greedy pairwise matching. Each track remembers its last position or appearance, and when a new frame comes in, the detection boxes are compared with each track by distance. It's fast, but it never treats a track as a whole; let an occlusion last a little longer or the appearance change a little more, and the track breaks.

Global trackers, such as min-cost flow or MPNTrack, build the detections from a whole video into a graph and solve for all the trajectories at once with combinatorial optimization. The results are steadier, but these methods are usually offline, slow, and trained separately from the detector.

The Transformer trackers of the same period, like TrackFormer and MOTR, represent tracks with DETR-style queries passed along frame by frame, so they're still local at heart.

The authors want something in between. It should look at a whole stretch at once, like a global tracker, yet be just a few layers in a network, trainable together with the detector and able to run online.

Solving the problem

Detect all the boxes first

Original Figure 2. GTR's overall pipeline. At the top are three frames of people canoeing; the detector finds objects (boats, people) independently in each frame, and the detections from all frames are lined up in a row (All-frame detections); the three colored blocks on the left are trajectory queries, which are fed together with all the detections into the Global Tracking Transformer, and an association result comes out on the right, with each row marking the box a query corresponds to in each frame.
Original Figure 2, Zhou et al., from PDF page 2, arXiv license, scholarly quotation.

The first step of GTR (Global TRacking transformer) is plain detection. The detector works independently on each frame, keeps the high-confidence objects after non-maximum suppression (NMS), and then uses RoIAlign to extract a DD-dimensional feature fitf_i^t from each box.

Stacking the features of all objects in a TT-frame clip gives F∈RN×DF\in\mathbb{R}^{N\times D}, where NN is the total number of objects across all frames. The Transformer that follows works only on these object features and never touches pixels.

A query is a detection from one frame

DETR's object queries are learned parameters. GTR's trajectory queries use detection features directly; to find someone's full trajectory, take that person's feature from one frame as the query.

The authors' reasoning is that there are far more possible trajectories than single boxes, so enumerating them would take a huge number of queries, and tracking datasets are small on top of that, so learned queries would easily memorize the training data.

One softmax per frame

Given a query qkq_k, the Transformer gives every object in the clip a score gitg_i^t. A softmax is then taken separately in each frame, giving the probability that "this trajectory is the ii-th box in frame tt":

PA(αt=i∣qk,F)=egit∑j∈{∅,1,…,Nt}egjtP_A(\alpha^t=i\mid q_k,F)=\frac{e^{g_i^t}}{\sum_{j\in\{\varnothing,1,\ldots,N_t\}}e^{g_j^t}}

The candidates include an extra ∅\varnothing, meaning "this object isn't in this frame," with its score fixed at 0.

Suppose the query is the feature of a person in frame 3, and follow it through two frames:

  • Frame 2 has two boxes, which the Transformer scores 4.0 and −1.0, plus 0 for ∅\varnothing. Exponentiated, they're 54.6, 0.37 and 1; after the softmax, the first box has a probability of about 0.975 and ∅\varnothing about 0.018. In frame 2, this trajectory is the first box.
  • In frame 1 the person is occluded, and the two boxes score only −2 and −3. The probability of ∅\varnothing is 1/(1+e−2+e−3)≈0.841/(1+e^{-2}+e^{-3})\approx 0.84, so the model decides the person isn't in this frame.

Fixing the score of ∅\varnothing at 0 amounts to drawing a baseline; if every box scores below 0, the answer is "not here." The query picks one box or ∅\varnothing in each frame, and strung together, these picks form a whole trajectory, whose probability is the product of the per-frame probabilities.

Training

During training, each ground-truth trajectory is first assigned to detection boxes. In each frame, the detection with the highest IoU with the ground-truth box is taken, and it only counts if that IoU exceeds 0.5; otherwise the frame gets ∅\varnothing.

Next, every object feature from every frame is used as a query. Any feature that belongs to a ground-truth trajectory is required to output that entire trajectory, and the loss is the sum over frames of the negative log probability of the correct answer. Features matched to no trajectory are treated as background and required to output ∅\varnothing in every frame.

The features of the same trajectory in different frames are all trained to output that same trajectory, so multiple queries can map to one trajectory, with no need for DETR's one-to-one matching. At inference, only the features from a single frame are used as queries; the detections in one frame are all distinct after NMS, so the trajectories they produce don't repeat.

The whole association module is treated as an RoI head of the detector and trained end to end together with the classification and box regression losses.

A very small Transformer

Original Figure 3. On the left is GTR's network structure: object features F (N, D) go through self-attention and two Linear/ReLU layers; queries Q (M, D) go through cross-attention over F and two Linear/ReLU layers; the two are matrix-multiplied to get the association matrix G (M, N). On the right are the details of the attention block, with each tensor's dimensions in parentheses.
Original Figure 3, Zhou et al., from PDF page 5, arXiv license, scholarly quotation.

Following the dimensions in the figure, the object features FF are (N,D)(N, D). They first go through one round of self-attention, letting objects from all frames exchange information, and then through two linear layers, with the dimensions unchanged. The queries QQ are (M,D)(M, D); they cross-attend to FF and likewise pass through two linear layers. Finally the two sides are multiplied to get the (M,N)(M, N) association matrix GG, where each row holds one query's scores for all objects, which are then split by frame for the softmax above.

The whole structure has just one encoder layer and one decoder layer. The authors found that self-attention among queries, Layer Normalization and positional encoding can all be left out. The entire module has only 10 linear layers and takes just 4 milliseconds per frame on MOT17, while the detector itself takes 47.

Running online

At inference, a sliding window of length T=32T=32 moves forward one frame at a time. The current frame's detection features serve as queries, yielding a set of trajectories spanning the past 32 frames.

These trajectories share many boxes with the existing tracks. The authors use the average association probability as the distance and match them one-to-one with the Hungarian algorithm; if the score is below 0.2, a new track is started.

MOT17 has a high frame rate, so positions in adjacent frames are very reliable, and on MOT17 the authors also bring in "the IoU between box and track," taking the larger of it and the association score. They don't do this on TAO.

On TAO, training without video

TAO's training set labels only some of the objects, and the authors found that training on it actually made detection worse. So the TAO model uses no TAO videos at all in training. The detector, CenterNet2, is trained on LVIS and COCO, and the tracking part follows CenterTrack's trick of making fake videos. One image gets two different data augmentations that serve as the start and end of a clip, with linear interpolation in between, giving a smooth 8-frame "video" used to fine-tune the tracking head.

Classification makes use of the trajectories too. For each track on TAO, the classification scores of all its boxes are averaged at the end to give the whole track's class score.

Discussion

The longer the window, the better the association

MethodTAO mAPTAO AssAMOT17 IDF1MOT17 AssA
IoU8.835.465.056.1
ReID10.939.574.063.7
IoU+ReID11.039.574.264.4
GTR, T=213.649.865.155.8
GTR, T=819.556.872.262.0
GTR, T=1622.557.475.165.0
GTR, T=3222.156.775.966.2

Compiled from Table 1 of the paper, TAO and MOT17 validation sets; all methods use detections from the same model.

The top three rows are local-tracking baselines, using FairMOT's implementation and default parameters, even keeping its mechanism for reviving tracks within 30 frames. IoU+ReID is roughly FairMOT's approach. Their re-ID features are trained with GTR's association loss; switching back to FairMOT's original identity classification loss actually drops TAO mAP to 6.7.

GTR with T=2T=2 sees only two adjacent frames, which makes it a local tracker that can't recover from any occlusion or missed detection. On MOT17, its IDF1 is about the same as the position-only IoU baseline. As the window grows, association improves steadily; at T=32T=32, MOT17 AssA is 1.8 above IoU+ReID and IDF1 is 1.7 higher.

On TAO, performance saturates at T=16T=16. The authors speculate that because TAO's frame rate is much lower, the scene changes too much within an overly long window. Also, on TAO, even looking at only two adjacent frames, GTR's AssA is 10 points higher than IoU+ReID.

TAO and MOT17 test sets

MethodVal mAPTest mAPFPS
SORT (TAO baseline)13.210.215.2
QDTrack16.112.45.4
GTR22.520.111.2
AOA25.827.51.0

Compiled from Table 2 of the paper; mAP is TAO's Track mAP (3D IoU 0.5), and FPS was measured by the authors on the same machine.

GTR scores 20.1 on the TAO test set, 62% higher than the previous best published result, QDTrack's 12.4. Part of that comes from a stronger detector; with QDTrack's detections instead, GTR's validation mAP is 20.4, still above QDTrack's 16.1, and AssA rises from 53.5 to 55.6.

The only entry in the table above GTR is AOA, winner of the 2020 TAO challenge. It trains several separate re-ID networks on large single-object tracking datasets and runs them once for every box. On the authors' machine, AOA takes 989 milliseconds per image; GTR is more than 10 times faster.

The comparison on the MOT17 test set:

MethodMOTAIDF1HOTA
TrackFormer65.063.9—
MOTR65.166.4—
TransTrack74.563.953.9
FairMOT73.772.359.3
CorrTracker76.573.660.7
TransMOT76.775.1—
GTR75.371.559.1

Compiled from Table 3 of the paper, MOT17 test set, private detections.

GTR's MOTA and IDF1 are both higher than those of the contemporary Transformer trackers TrackFormer, MOTR and TransTrack. Its HOTA is about the same as FairMOT's, and its IDF1 slightly lower. TransMOT is 1.4 MOTA above GTR, but it uses YOLOv5 as its detector and extra re-ID data, and its code isn't public; GTR runs at 19.6 frames per second, roughly twice as fast.

Design trade-offs

The authors ran several ablations on the MOT17 validation set, where rerunning the same setting a few times varies by about 0.5 AssA:

  1. Drop attention and take dot products of the features directly: AssA falls from 66.2 to 63.6. Adding self-attention among queries, as DETR does, gives an AssA of 64.5, which doesn't help.
  2. Add positional encoding, or positional plus temporal encoding: AssA is 65.0 and 64.6 respectively, both worse than without, so the final model doesn't use them.
  3. Number of layers: one encoder layer and one decoder layer are enough. Other Transformer trackers mostly need 6, which the authors suspect is because those take in pixels, while GTR takes in features of objects that have already been detected.
  4. Adding position information at inference: MOT17 AssA rises from 63.3 to 66.2; TAO mAP stays at 22.5 either way.

Limitations

The window length of 32 is capped by GPU memory. GTR can't bridge an occlusion or missed detection longer than 32 frames. Most MOT17 videos run at 30 frames per second, so 32 frames is about one second.

GTR only groups boxes that have already been detected and never generates new boxes itself; an object the detector misses can't be recovered, however good the association. The TAO model was also trained only on still images, because there was no public multi-class tracking training set at the time; the authors list new datasets like UVO as a next step.

Conclusion

GTR shrinks global association down to a single RoI head on the detector. Queries are taken directly from detection features, a softmax with ∅\varnothing in each frame decides the corresponding box, and a single forward pass yields trajectories over 32 frames.

In the experiments, association improves steadily as the window grows, beating FairMOT-style association on MOT17 with the same detections. On TAO, with its huge variety of objects, the design plugs straight into a large-vocabulary detector and, trained only on still images, pushes test-set Track mAP from 12.4 to 20.1.

The tracking head is so small that it takes only 4 milliseconds per frame on MOT17, and nearly all the time goes to the detector. What stands in the way of a longer window is GPU memory.