MeMOT: Multi-Object Tracking with Memory
- 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}
}
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.

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:
- Run online, with detection and association done in the same network.
- Keep a long history for each object, and be able to pick out the useful parts of that history according to the current situation.
- Output results that already carry identities, with no post-processing such as Hungarian matching or NMS.
Solving the problem
Three modules

In every frame, MeMOT runs three modules in order.
- Hypothesis generation . A Deformable DETR (ResNet-50 backbone, COCO-pretrained). The encoder turns the image into features, and the decoder outputs proposal embeddings, each meaning "there may be an object here," which could be new or already being tracked.
- Memory encoding . For each track currently being followed, its history is read from memory and compressed into a track embedding.
- Memory decoding . A Transformer decoder. Proposal embeddings and track embeddings are concatenated as queries, with the image features from the 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 tensor. is the number of objects, the maximum number of time steps kept per object, and each step stores a -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

For object at frame , 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 , and K and V are the memory from the last 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 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

Each decoder output has a box and two scores. The objectness score asks "is there a visible object here?", and the uniqueness score asks "should this output be the one to report it?" The final confidence score is their product:
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:
- A's track query: , , output with A's existing identity.
- A proposal query also finds A: , , suppressed.
- Another proposal query finds B: , , starting a new track.
- A proposal query lands on a blank wall: , 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:
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
| Method | IDF1 | MOTA | AssA | IDsw |
|---|---|---|---|---|
| FairMOT | 72.3 | 73.7 | 58.0 | 3,303 |
| TransTrack | 63.5 | 75.2 | 47.9 | 3,603 |
| TransCenter | 62.2 | 73.2 | 49.7 | 4,614 |
| TrackFormer | 63.9 | 65.0 | — | 3,258 |
| MOTR | 67.0 | 67.4 | — | 1,992 |
| MeMOT | 69.0 | 72.5 | 55.2 | 2,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

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-term | Long-term | IDF1 | IDsw |
|---|---|---|---|
| Latest state | Learnable token | 73.15 | 93 |
| Latest state | Latest state | 72.30 | 103 |
| Learnable token | Latest state | 67.25 | 112 |
| Learnable token | Learnable token | 41.09 | 207 |
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.