Back to paper library
arXiv 2020IEEE TIP 2022Object trackingPaper notes

CSTrack

Same Bed, Different Dreams

Original paper

Rethinking the competition between detection and ReID in Multi-Object Tracking

Paper authors

Chao Liang · Zhipeng Zhang · Xue Zhou · Bing Li · Shuyuan Zhu · Weiming Hu

First submitted to arXiv
arXiv:2010.12138
Cite this paper · BibTeX

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

@misc{multiobjecttrackingcstrack2020,
  title = {{Rethinking the competition between detection and ReID in Multi-Object Tracking}},
  author = {Chao Liang and Zhipeng Zhang and Xue Zhou and Bing Li and Shuyuan Zhu and Weiming Hu},
  year = {2020},
  eprint = {2010.12138},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2010.12138}
}
On this page

JDE crammed detection and re-ID into one network. A single forward pass outputs both the boxes and the appearance features, and tracking finally got fast. The price was accuracy, which kept trailing the two-stage methods that detect first and then run a separate re-ID network.

In 2020, several papers went looking for the cause. FairMOT blamed the anchors, the feature levels and the feature dimension. This CSTrack paper, from the University of Electronic Science and Technology of China and the Institute of Automation of the Chinese Academy of Sciences, put the question another way. The two tasks share the same features, so could what each of them wants to get out of those features be in outright conflict?

Defining the problem

Original Fig. 1. (a) Two similarity heat maps of the same street scene. On the left is the detection similarity, where every pedestrian in the frame lights up; on the right is the ID embedding similarity, where only a few specific locations light up. (b) FPN feature maps at different resolutions, from high to low, each focusing on pedestrians of a different size, with an arrow marking resolution going from high to low.
Original Fig. 1, Liang et al., from PDF page 1, arXiv license, scholarly quotation.

The authors sort the problems of one-shot trackers into two kinds of competition.

The first is in representation. Panel (a) shows two kinds of similarity on the same street scene. Detection wants a high response on every pedestrian: Alice and Bob are both "person", and the more alike they look, the better. Re-ID wants only that one particular person to light up, with Alice and Bob kept as far apart as possible. Starting from the same features, one task demands that members of a class look alike and the other demands that individuals look different, so the two pull against each other during training.

The second is in scale assignment. Modern detectors all use an FPN, handing large objects to low-resolution feature maps and small objects to high-resolution ones, which is how the boxes come out accurate. JDE's re-ID branch copies this assignment wholesale, and each box takes its appearance feature from the level it belongs to. The trouble is that when someone walks toward the camera from far away and grows from 60 to 200 pixels tall, the features of the first few frames may come from the 1/8 level and those of later frames from 1/16 or 1/32. Features from different levels sit at different semantic levels, so comparing the same person across frames amounts to measuring with two different rulers.

Solving the problem

Original Fig. 2. (a) The feature extractor: the input frame passes through the backbone to give features at 1/8, 1/16 and 1/32, which the Neck (FPN) fuses into F1, F2 and F3. (b) JDE's prediction head: the three feature levels go straight into parallel Detection and ReID branches, both outputting at three resolutions, with ReID outputting ID embeddings at three resolutions. (c) CSTrack's prediction head: the three feature levels first pass through REN and are split into two copies, green going into Detection and orange into ReID (SAAN); Detection still outputs at three resolutions, while ReID outputs a single ID embedding map at 1/8 resolution.
Original Fig. 2, Liang et al., from PDF page 4, arXiv license, scholarly quotation.

CSTrack builds on JDE. It first swaps the detector from YOLOv3 to YOLOv5, then touches only the prediction head. Comparing panels (b) and (c), there are two differences. In (c), a REN sits in front of the two branches and splits the shared features into one copy for detection and one for re-ID; the re-ID branch is replaced by SAAN, which no longer outputs embeddings at three resolutions, only a single one at 1/8. The former deals with the first kind of competition, the latter with the second.

REN: each task regroups the channels its own way

Original Fig. 3. REN's structure. The input feature F_i (C × H × W) is first average-pooled to F′_i (C × H′ × W′), then two convolutions give M_1 (green) and M_2 (orange), both of size C × H′W′. M_1 is multiplied by its own transpose and passed through softmax to give the self-relation map W_T1; M_1 is multiplied by the transpose of M_2 and passed through softmax to give the cross-relation map W_S1; the two are added to give W_1. On the M_2 side, W_T2, W_S2 and W_2 are obtained the same way. The original feature, after a 1×1 convolution and a reshape, is multiplied by W_1 and W_2 separately and then added back to the original feature, outputting F_i^T1 (green, for detection) and F_i^T2 (orange, for re-ID).
Original Fig. 3, Liang et al., from PDF page 4, arXiv license, scholarly quotation.

REN stands for reciprocal network. Put plainly, it lets each of the two tasks decide for itself how to recombine the CC channels of the shared features.

Let's follow the shapes through, starting with the input FiF_i, the feature map of one level, of size C×H×WC \times H \times W.

  1. Shrink first. Average-pool it to 6×106 \times 10 to get Fi′F'_i. This copy is only used to compute the relations between channels, so the original size isn't needed.
  2. Project separately. Two convolutions project Fi′F'_i into M1M_1 (detection) and M2M_2 (re-ID), which are then flattened to C×60C \times 60. Each channel is now a 60-dimensional vector recording its response at 60 positions.
  3. Self-relation. M1M1⊤M_1 M_1^\top is a C×CC \times C matrix whose entry in row ii, column jj says how similar channel ii and channel jj are within the detection branch. A softmax over each row gives WT1W_{T_1}. The re-ID side gives WT2W_{T_2} the same way.
  4. Cross-relation. Using M1M2⊤M_1 M_2^\top instead measures how similar detection's channel ii is to re-ID's channel jj; after the softmax this gives WS1W_{S_1}, and the reverse gives WS2W_{S_2}.
  5. Mix the two. A learnable weight λk\lambda_k weights the two kinds of relation:
Wk=λkWTk+(1−λk)WSk,k∈{1,2}W_k = \lambda_k W_{T_k} + (1 - \lambda_k) W_{S_k}, \quad k \in \{1, 2\}

Finally, the full-size FiF_i goes through a 1×1 convolution and is flattened to C×HWC \times HW, left-multiplied by WkW_k, reshaped back to C×H×WC \times H \times W and added to the original features. Every row of WkW_k is a set of weights summing to 1, so every output channel is a weighted combination of the input channels. Detection and re-ID each get their own regrouped copy of the features, which then goes into the corresponding branch.

Self-relation lets each task emphasize the channels it needs, and cross-relation lets it consult the channels the other task finds important. The two tasks still share the backbone and only take what they each need at this one step before entering their branches. Channel similarity is computed over just 6×10=606 \times 10 = 60 positions, so the extra computation is limited.

SAAN: everyone's features come from the same map

Original Fig. 4. (a) SAAN's overall structure. The 1/8 features keep 256 channels through a 3×3 convolution; the 1/16 features with 512 channels and the 1/32 features with 1024 channels are each upsampled to 1/8 and reduced to 256 channels with a 3×3 convolution. Each of the three paths gets a SAM (spatial attention), whose output is multiplied element-wise with the original features and then added to them; the three are concatenated into 768 channels and pass through a CAM (channel attention), again multiplied and added, and a final 3×3 convolution outputs a 512-channel ID embedding map E. (b) SAM: max pooling and average pooling along the channel dimension are concatenated and passed through a convolution and a sigmoid to give a spatial attention map. (c) CAM: global average pooling and max pooling each give a vector, which pass through a shared Conv1d and FC, are added, and go through a sigmoid to give the channel attention.
Original Fig. 4, Liang et al., from PDF page 5, arXiv license, scholarly quotation.

SAAN deals with the second kind of competition by simply not splitting by level at all. The 1/16 and 1/32 features are upsampled to 1/8, and all three levels are brought to 256 channels. Each level passes through its own spatial attention, which pushes the background down and brings out where the people are; the three levels are concatenated into 768 channels, channel attention then decides which channels matter more, and the output is a single 512-dimensional embedding map at 1/8.

Back to the person walking toward the camera from far away. Whether they are 60 or 200 pixels tall in the frame, their appearance feature is taken from the same 1/8 embedding map, at the location of the detection box. The map itself already fuses three resolutions, so frames are compared with the same ruler.

Training and tracking

The detection loss follows YOLOv5, with focal loss for classification and CIoU for box regression. Re-ID is treated as a classification problem, as in JDE, with one class per person in the training set and a cross-entropy loss. The total loss is Ldet+ηLidL_{det} + \eta L_{id}, with η\eta set to 0.02; we'll see later just how sensitive that number is.

The tracking stage reuses JDE's association pipeline unchanged. Matching first uses the cosine similarity of appearance features, with the Kalman filter's predicted positions ruling out implausible pairs, and is solved with the Hungarian algorithm; whatever is left unmatched is matched once more by IoU. Each track's appearance template is updated with a momentum of 0.9, and a track ends after 30 consecutive frames without a match.

Discussion

The training data is the same as JDE's, six pedestrian datasets in all, with CrowdHuman added when comparing final results. Training runs for 30 epochs on a single RTX 2080 Ti. Evaluation is on MOT16, MOT17 and the more crowded MOT20, looking mainly at MOTA and IDF1, the latter being a better reflection of how well association works.

What each module contributes

SettingMOTAIDF1
JDE (YOLOv3)64.455.8
JDE (YOLOv5)68.960.7
+ REN70.863.1
+ SAAN69.469.3
+ REN + SAAN72.971.6

Compiled from Table I of the paper, MOT16 test set, trained on six datasets.

Switching to YOLOv5 by itself brings 4.5 points of MOTA. On top of that, REN helps both metrics, adding 1.9 MOTA and 2.4 IDF1; SAAN moves almost nothing but IDF1, adding a full 8.6 in one go, which is just what you'd expect from a design that only changes the re-ID branch. With both, MOTA is 8.5 above the original JDE and IDF1 15.8 above.

The two kinds of relation inside REN were also tried separately. Self-relation alone is a little better than none at all. Cross-relation alone actually drops IDF1 from 68.7 to 67.2; learning only what the two tasks have in common can't resolve their conflict. A fixed half-and-half mix does worse than self-relation alone; only when λ\lambda is learned do they get the best 66.0 and 70.7, with a quarter fewer ID switches as well. The learned λ1\lambda_1 is 0.12 and λ2\lambda_2 is 0.32, so both tasks borrow heavily from the cross-relation, and detection borrows more than re-ID. The authors also swapped REN for ordinary convolutions of comparable cost, and REN still came out ahead, so the gain isn't just a matter of having more parameters.

How fierce is the competition?

What best shows that "the two tasks are fighting over the features" is the sweep of the loss weight η\eta.

η\etaMOTAIDF1
121.135.2
0.654.260.5
0.264.569.0
0.0266.070.7
0.00565.867.2

Compiled from Table V of the paper, MOT17 validation set.

With the re-ID loss weighted equally to the detection loss, MOTA is only 21.1, and detection is all but wrecked. It only recovers once the weight is pushed down to 0.02, and pushing further makes IDF1 start dropping again. Even with REN and SAAN, the two tasks still rely on a hand-tuned number to stay balanced, and that number's usable range is quite narrow.

Against other trackers

On MOT16, CSTrack reaches 75.6 MOTA and 73.3 IDF1 at 16.4 frames per second; FairMOTv2, also one-shot and trained on the same data, gets 74.9 and 72.8 at 18.9 frames per second. On MOT17, both have an IDF1 of 72.3, with MOTA at 74.9 versus 73.7.

The gap opens up on MOT20, the most crowded of the three. CSTrack's MOTA is 66.6 to FairMOTv2's 61.8; FairMOTv2 has 103,440 false positives against CSTrack's 25,404, and ID switches drop from 5,243 to 3,196. The price is speed, with only 4.5 frames per second left on MOT20.

The authors also built a lightweight CSTrack-S, cutting the convolution channels and layers to 30% of the original. On MOT16, MOTA falls to 73.8 and IDF1 to 71.0, while speed rises to 34.6 frames per second.

With the detector out of the picture

To look at association on its own, the authors replaced the detections on the MOT16 training set with ground-truth boxes, with all three methods trained only on MOT17. Under these conditions, JDE's IDF1 is 87.6, DeepSORT-2, which uses a separate re-ID network, gets 95.6, and CSTrack 96.6. When every box is correct, CSTrack's appearance features already hold their own against running a separate re-ID network. Except that MOT16 and MOT17 use the same videos, so all three methods saw this footage in training; it's an exam made of the practice questions. Which of the three comes out ahead is still informative, but don't take the absolute scores in the nineties too seriously.

Limitations

The authors list two kinds of failure: the detector taking people for background when the image is blurry, and people who are only partly visible being missed under heavy occlusion. Both come from looking at single frames only, and the authors plan to bring in temporal information later.

Before using it, know that the official code lives in the MOT branch of SOTS, where REN goes by CCN, its name in the paper's first version. The README states that the released version reaches 70.7 MOTA on MOT16, nearly 5 points below the 75.6 of the paper's final version, and says a new version will be released. The branch was last updated at the end of 2021. (Nearly five years on, the new version is presumably still on its way)

Conclusion

Detection wants members of a class to look alike and re-ID wants individuals to look different, so the two are bound to fight when they share one set of features. CSTrack doesn't split them into two networks. Instead, it adds one extra step before they go their separate ways, letting each task regroup the channels its own way, and then has re-ID merge three resolutions into one map, so the same person is compared on the same ruler whether near or far.

The effect is clearest in crowded scenes, with false positives and ID switches on MOT20 both falling sharply. But the η\eta sweep is also a reminder that the conflict has only been eased; the balance between the two tasks still hangs on 0.02, a hand-tuned weight.