Back to paper library
arXiv 2022CVPR 2022Object trackingPaper notes

MeMOT

Remember Me?

Original paper

MeMOT: Multi-Object Tracking with Memory

Paper authors

Jiarui Cai · Mingze Xu · Wei Li …

Show all 7 authors

Jiarui Cai · Mingze Xu · Wei Li · Yuanjun Xiong · Wei Xia · Zhuowen Tu · Stefano Soatto

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

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

@misc{multiobjecttrackingmemot2022,
  title = {{MeMOT: Multi-Object Tracking with Memory}},
  author = {Jiarui Cai and Mingze Xu and Wei Li and Yuanjun Xiong and Wei Xia and Zhuowen Tu and Stefano Soatto},
  year = {2022},
  eprint = {2203.16761},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2203.16761}
}
On this page

TrackFormer and MOTR turn each tracked object into a query vector that is passed along frame by frame. The previous frame's output is the next frame's query, and an object's entire history is squeezed into that one vector.

That's a lot like the thinking behind the Kalman filter. A Kalman filter summarizes all past observations with a single Gaussian, and under linear, Gaussian assumptions, that's already the best possible estimate. But occlusion is neither linear nor Gaussian. If a person is hidden for four frames, how should those four frames of observations update that one and only state?

Mingze Xu, Zhuowen Tu, Stefano Soatto and colleagues at Amazon's AWS AI Labs, together with Jiarui Cai of the University of Washington, then an intern at Amazon, decided to keep more than one state. They store what each object looked like over the past twenty-odd frames and look back at it in every frame as needed.

Original Figure 1. The idea behind MeMOT. At the top are the input and tracking results for frame t; at the bottom is the Memory Buffer, where each row holds the person crops of one object (i, j, k) in each frame from t−T to t−1, and an empty box means the object was occluded or not detected in that frame. In the tracking results, the yellow and blue boxes are people tracked continuously, the red box is a person re-linked after an occlusion, and the green box is a newly appearing person.
Original Figure 1, Cai et al., from PDF page 1, CC BY 4.0.

The memory buffer at the bottom is the star of this paper. Each row is one object, holding its features from each past frame. Object i's most recent few slots are empty, meaning it was occluded; when it reappears, MeMOT has to rely on these old records to recognize it again.

Defining the problem

Online multi-object tracking has long been split into two steps, detecting first and then linking the detection boxes across time. Later, many methods merged the two steps into one network; JDE and FairMOT, for example, have the detector output re-ID features at the same time, and TrackFormer and MOTR have the Transformer handle both detection and continuing tracks.

The authors argue that after the merge, association often gets oversimplified. An object's state is passed only between adjacent frames, which runs fast, but objects that are occluded for a while, or vanish for a long time and then reappear, are hard to link back.

MeMOT aims to do three things at once:

  1. Run online, with detection and association done in the same network.
  2. Keep a long history for each object, and be able to pick out the useful parts of that history according to the current situation.
  3. Output results that already carry identities, with no post-processing such as Hungarian matching or NMS.

Solving the problem

Three modules

Original Figure 2. The MeMOT architecture. On the left is the input video stream; at the top is the hypothesis generation module Θ_H, whose Transformer encoder encodes the image into features and whose decoder produces Proposal Embeddings; at the bottom left is the memory encoding module Θ_E, where the memory buffer stores each track's past states, which the memory aggregator turns into Track Embeddings; on the right is the memory decoding module Θ_D, which concatenates the two kinds of embeddings into queries, uses the image features as K and V, and through the association solver outputs new objects, tracked objects, suppressed objects and background, then feeds back to update the memory.
Original Figure 2, Cai et al., from PDF page 3, CC BY 4.0.

In every frame, MeMOT runs three modules in order.

  1. Hypothesis generation ΘH\Theta_H. A Deformable DETR (ResNet-50 backbone, COCO-pretrained). The encoder turns the image into features, and the decoder outputs NproN_{pro} proposal embeddings, each meaning "there may be an object here," which could be new or already being tracked.
  2. Memory encoding ΘE\Theta_E. For each track currently being followed, its history is read from memory and compressed into a track embedding.
  3. Memory decoding ΘD\Theta_D. A Transformer decoder. Proposal embeddings and track embeddings are concatenated as queries, with the image features from the ΘH\Theta_H encoder as K and V. Each query outputs a box and two scores.

After the output, the new states of tracked objects are written back to memory; each newly appearing object gets a new row in memory.

What the memory looks like

The memory is an N×T×dN\times T\times d tensor. NN is the number of objects, TT the maximum number of time steps kept per object, and each step stores a dd-dimensional embedding. It's a first-in, first-out (FIFO) queue, so once the length limit is exceeded, the oldest slot is pushed out. If the object is absent in a frame, that slot is filled with 0.

MOT16 and MOT17 store at most 300 tracks, and MOT20 600. As for length, the ablations try up to 24 frames; the models in the main comparison store 22 frames for MOT16 and MOT17 and 20 frames for MOT20, and the authors say the limit comes from GPU memory.

How the memory is read

Original Figure 3. The memory aggregator. At the top is object k's memory from t−1−T to t−1, with red crosses marking absent frames; the most recent few frames are the short-term memory and the whole span is the long-term memory, each fed into its own cross-attention. The short-term branch uses the latest state as the query and outputs the aggregated short-term token (AST); the long-term branch uses DMAT as the query and outputs the aggregated long-term token (ALT); the two are concatenated and passed through self-attention, which outputs the track embedding and updates DMAT for use in the next frame.
Original Figure 3, Cai et al., from PDF page 4, CC BY 4.0.

For object kk at frame tt, say, the memory holds embeddings from the past 24 frames, with a few slots of 0 in between.

Short-term branch. The query is its most recent state Xt−1X^{t-1}, and K and V are the memory from the last Ts=3T_s=3 frames. The last few frames look very much alike, so this step works like smoothing, wiping out single-frame noise and producing the aggregated short-term token (AST).

Long-term branch. The query is instead a vector called DMAT (Dynamic Memory Aggregation Token), and K and V are the memory over the full Tl=24T_l=24 frames. Every new track's DMAT starts from the same learned initial value and is then updated once per frame, each one evolving on its own. This step fishes useful features out of the more distant past, such as the last clear look before an occlusion, producing the aggregated long-term token (ALT).

Fusion. AST and ALT go through self-attention together, outputting this frame's track embedding and the updated DMAT, which is kept for the next frame.

Why use the latest state as the short-term query and DMAT as the long-term one? The ablations later on answer that.

Two scores

Original Figure 4. How ground-truth labels are assigned. The association solver predicts a box, an Objectness Score and a Uniqueness Score for each output, and the confidence score is the product of the two. Tracked objects have all three scores at 1; new objects also have all 1s; suppressed objects have objectness 1, uniqueness 0 and confidence 0; background has objectness 0, uniqueness 1 and confidence 0.
Original Figure 4, Cai et al., from PDF page 5, CC BY 4.0.

Each decoder output ii has a box and two scores. The objectness score oito_i^t asks "is there a visible object here?", and the uniqueness score uitu_i^t asks "should this output be the one to report it?" The final confidence score is their product:

sit=oit⋅uits_i^t=o_i^t\cdot u_i^t

A track query's uniqueness score is always 1, so its objectness score says whether the object is still there in this frame. A proposal query's uniqueness score is 1 only when what it found is a new object not yet being tracked.

Take one frame, where A is a person already being tracked and B has just walked into view:

  1. A's track query: o≈1o\approx 1, u=1u=1, output with A's existing identity.
  2. A proposal query also finds A: o=1o=1, u=0u=0, suppressed.
  3. Another proposal query finds B: o=1o=1, u=1u=1, starting a new track.
  4. A proposal query lands on a blank wall: o=0o=0, discarded.

At inference, the only check is whether the confidence score clears a threshold, 0.7 for proposal queries and 0.6 for track queries. Track queries that pass keep their existing identities, proposal queries that pass get new ones, and nothing after the network needs to do any matching or NMS.

With only one score, the same number would have to express two things at once. For a track query it means "still there or not"; for a proposal query, "new or not." Whether a low score means "no object" or "not a new object" is hard for the classification layer to sort out. Splitting it into two scores makes that problem go away.

Training

When labels are assigned, a track query is matched to its own identity; if the object appears in this frame, it gets the box and an objectness score of 1, and if not, 0. Proposal queries, as in DETR, are matched by bipartite matching to all the ground-truth boxes in the frame, new or old; once matched, whether the object has appeared before decides the uniqueness score.

The tracking loss is:

Ltck=λcls(Lobj+Luni)+λL1Lbbox+λiouLiou\begin{aligned} L_{tck}={}&\lambda_{cls}(L_{obj}+L_{uni}) \\ &+\lambda_{L1}L_{bbox}+\lambda_{iou}L_{iou} \end{aligned}

The two scores use focal loss and the box uses L1 and GIoU losses, with weights of 2, 5 and 2 respectively. An auxiliary detection head is also attached to the proposal embeddings, computing a detection loss the Deformable DETR way to help localization; it's removed after training.

Training works on clips. Clip length starts at 2 frames and grows by 4 frames every 20 epochs; the frames in a clip are sampled at random intervals of 1 to 10 frames. Training runs for 200 epochs in total on 8 A100s, with every Transformer cut down to 4 layers. The MOT16 and MOT17 models use the CrowdHuman validation set plus the MOT17 training set; MOT20 uses only its own training set.

Discussion

MOT17 and MOT20

MethodIDF1MOTAAssAIDsw
FairMOT72.373.758.03,303
TransTrack63.575.247.93,603
TransCenter62.273.249.74,614
TrackFormer63.965.0—3,258
MOTR67.067.4—1,992
MeMOT69.072.555.22,724

Compiled from Table 1 of the paper, MOT17 test set; the IDsw values for TransTrack and TransCenter come from the same leaderboard entries in Table 4 of the ByteTrack paper.

Among the Transformer trackers, MeMOT has the highest IDF1 and AssA. TransTrack's MOTA is higher, but it relies on IoU matching, and it has about 30% more ID switches (IDsw) than MeMOT, with an IDF1 5.5 lower. MOTR has the fewest ID switches, just 1,992, but both its IDF1 and MOTA are lower than MeMOT's.

FairMOT's IDF1 and AssA are still higher than MeMOT's. The paper makes a point of marking how much training data each method used; taking the MOT training set itself as 1×, FairMOT used 13.1× and MeMOT 1.9×.

On the crowded MOT20, MeMOT uses no extra data at all and gets an IDF1 of 66.1 and MOTA of 63.7, on par with FairMOT (67.3 and 61.8), which used 8.2× the data, yet with only 1,938 ID switches, 63% fewer than FairMOT's 5,243. The authors explain that the people in MOT20 are small and the lighting is dim, so re-ID features are unreliable, and IoU matching can't cope with frequent occlusion.

Which frames the attention looks at

Original Figure 6. On the left are the tracking results at frames 118 and 129; on the right are crops of two people, ID 55 and ID 62, from frames 119 to 128, along with the long-term and short-term attention for each frame, where darker colors mean higher weights.
Original Figure 6, Cai et al., from PDF page 7, CC BY 4.0.

ID 55 is hidden by ID 60 from frame 125 to 128. When MeMOT re-links ID 55 at frame 129, the long-term attention weighs frame 124 most heavily, the last moment before the occlusion, followed by frame 121, which caught the whole body. The short-term attention goes to frame 128, where the person is only partly hidden, weighted higher than the fully hidden frames 126 and 127.

ID 62 isn't occluded, so the attention concentrates on the most recent frames, 126 to 128, and the earlier a frame, the less it's looked at.

Ablations

The ablations use a slimmed-down 2-layer model, trained on the MOT17 training set and validated on the MOT15 training set, with videos that overlap the training set excluded.

Long-term memory length. Stretching long-term memory from 3 to 24 frames raises IDF1 from 71.27 to 73.15 and cuts ID switches from 136 to 93. With short-term memory anywhere from 2 to 5 frames, IDF1 stays between 72.4 and 73.2, and 3 frames was the final pick.

Swapping in simple pooling. Taking the mean or max over the memory directly works poorly. Averaging the last 3 frames gives an IDF1 of only 25.04; taking the max gives 46.83; averaging over 24 frames even turns MOTA negative.

Choosing the queries.

Short-termLong-termIDF1IDsw
Latest stateLearnable token73.1593
Latest stateLatest state72.30103
Learnable tokenLatest state67.25112
Learnable tokenLearnable token41.09207

Compiled from Table 4 of the paper.

Switching the short-term query to a learnable token drops IDF1 by 5 points; with learnable tokens on both sides, IDF1 falls to 41.09. Switching the long-term query from the latest state to a learnable token adds 0.85 IDF1 and removes 10 ID switches.

The authors' reading is that the last few frames look very much alike, so querying them with the latest observation is just right for averaging out the noise; long-term memory varies a lot, and the latest look may not match how the object looked long ago, so a token learned specifically for aggregating does a better job of fishing out useful information.

Whether to update DMAT. If the long-term branch's DMAT isn't updated over time, IDF1 drops from 73.15 to 61.03 and MOTA from 68.08 to 43.42.

One score or two. With a single confidence score, IDF1 is 69.09 and MOTA 63.51; split into objectness and uniqueness scores, they're 73.15 and 68.08.

Limitations

In their limitations, the authors note that MeMOT is supervised and needs videos with tracking annotations, which are scarce and expensive, and that the spatio-temporal memory increases GPU memory use during training, which limits how long the memory can be.

In terms of time, most MOT17 videos run at 30 frames per second, so 22 frames is under 0.75 seconds. The memory is first-in, first-out, so if a person stays hidden longer than the memory length, the look from before the occlusion has already been pushed out of the queue.

Also, the paper comes with no official code, so reproducing it means implementing it yourself.

Conclusion

MeMOT gives each object a stretch of history instead of a single state vector. The memory aggregator reads that history along two paths, short-term and long-term, and the objectness and uniqueness scores let the decoder output results with identities directly, with no post-processing.

The most convincing evidence comes from MOT20. In crowded, heavily occluded scenes, MeMOT uses no extra data and still has over 60% fewer ID switches than FairMOT. The attention visualization also shows that after an occlusion, it really does look back for the frames from just before the person was hidden, or the ones that caught the whole body.

Still, the "long-term" here is under a second. A little over a year later, MeMOTR changed tack. Instead of storing every frame's embedding, it keeps a slowly updated average for each track that covers roughly the last 100 frames; its HOTA on MOT17 is also nearly two points above MeMOT's.