SAMURAI: Adapting Segment Anything Model for Zero-Shot Visual Tracking with Motion-Aware Memory
- Publication
- Publication venue not yet verified
- First submitted to arXiv
- arXiv:2411.11922
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@misc{segmentationsamurai2024,
title = {{SAMURAI: Adapting Segment Anything Model for Zero-Shot Visual Tracking with Motion-Aware Memory}},
author = {Cheng-Yen Yang and Hsiang-Wei Huang and Wenhao Chai and Zhongyu Jiang and Jenq-Neng Hwang},
year = {2024},
eprint = {2411.11922},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2411.11922}
}
In November 2024, a group of researchers at the University of Washington released SAMURAI. It trains no parameters at all. It takes the SAM 2.1 weights as they are, wraps a Kalman filter and a set of rules for picking memories around them, and on single-object tracking benchmarks such as LaSOT, LaSOT-ext and GOT-10k it matches or beats a whole crowd of trackers trained specifically for the job. By November 2026 the official code had gathered over seven thousand stars.
SAM 2 can already follow an object through a video, so why does it need these add-ons? The paper's answer comes down to two very specific mistakes.
Defining the Problem
The rules of single-object tracking (Visual Object Tracking, VOT) are simple. You get a box on the first frame, and on every frame after that you have to box the same target. LaSOT is a commonly used long-video benchmark. Across the whole dataset, a video averages about 2,500 frames, and the test set has 280 videos. Targets get occluded, leave the frame and crowd together with things that look very much like them.
SAM 2 does video object segmentation and outputs masks, but take a mask's bounding box and you have a tracking result. For each frame, the image encoder first computes that frame's features, memory attention has those features read the memories of the past few frames stored in the memory bank, and the mask decoder then outputs several candidate masks. Each candidate mask comes with a predicted IoU, standing for how accurate the model thinks the mask is, which SAMURAI calls the affinity score. There is also an object score, which judges whether the target is actually in view on this frame.
SAM 2 picks the mask with the highest affinity as its answer, encodes it into a memory and puts it in the memory bank. The memory bank is a first-in, first-out queue; apart from the first frame, it only ever keeps the most recent 6 frames.
On VOT, this pipeline makes two typical mistakes.

The top row is the first kind. A group of penguins stands together, and right next to the target is one that looks almost identical. SAM 2 sees several candidate masks; one of them covers the neighbor, its predicted IoU actually comes out higher, and SAM 2 picks it. It never stops to think that the target was on the left just one frame ago and can't suddenly be on the right now.
The bottom row is the second kind. During the frames when the target car is blocked, SAM 2 outputs masks as usual and stores them as memories as usual. By the time the car reappears, several of the 6 most recent frames in the memory bank are wrong; the model tries to recognize the car against wrong memories and drifts further and further off.
Both problems point to the same thing. SAM 2 looks only at appearance and ignores how the target moves; it isn't picky about memory either, taking the most recent 6 frames wholesale. SAMURAI sets out to add motion and selection without retraining anything.
Solving the Problem

The lower half of the architecture diagram is the original SAM 2, and SAMURAI touches only two places. On the right is an added Motion Modeling, which chooses among the candidate masks; at the top left, Memory Selection replaces the fixed window and decides which frames may enter the memory bank. Not a single model weight is changed.
Choosing the Mask: Adding a Motion Score
The motion model is a linear Kalman filter. For each candidate mask, SAMURAI takes the minimum and maximum coordinates of its non-zero pixels and turns them into a bounding box. From the position and velocity over the previous few frames, the Kalman filter first predicts where the target should be in this frame, giving a predicted box .
Next, the IoU between each candidate box and the predicted box is computed; this is the motion score . The final choice is a weighted sum of the two scores:
is the original affinity. Once a mask is chosen, its box is used to update the Kalman filter, ready for the next frame's prediction.
The official setting for is 0.15, so the motion score makes up only a small part. Let's run the numbers on the penguins and see what that 15% can do. Suppose SAM 2 gives three candidate masks:
| Candidate | affinity | Motion score | Weighted |
|---|---|---|---|
| A: the penguin next door | 0.93 | 0.05 | 0.798 |
| B: the target | 0.86 | 0.80 | 0.851 |
| C: covers only half the body | 0.60 | 0.30 | 0.555 |
Going by affinity alone, SAM 2 would pick A. With the motion score added, A gets and B gets , so B wins instead.
Working backwards, A's affinity would have to exceed 0.9924 to win it back. A motion-score gap of 0.75 comes to about 0.11 after weighting, enough to make up an affinity gap of roughly 0.13. When the appearance scores are far apart, SAMURAI still trusts appearance; only when two candidates look about the same does position decide it.
There is a safeguard as well. When the Kalman filter has just started, or the target has just come out of an occlusion, its predictions aren't reliable. The paper specifies that the motion score is switched on only after the filter has been updated successfully on every one of the last frames. The official code sets this to 15 frames; whenever the mask chosen on some frame has a predicted IoU below 0.3, the count resets to zero and selection falls back to affinity alone.
Picking Memories: Don't Remember the Bad Frames
The second change targets the memory bank. SAMURAI gives every frame three scores: affinity, object score and motion score. Only frames that clear all three thresholds qualify as memories.
It searches backwards starting from the previous frame, collecting qualifying frames, and keeps the memory bank's total at , that is, the first frame plus 6 others. That number stays unchanged because SAM 2 was trained with this memory length. The thresholds in the official code are affinity above 0.5, an object-score logit above 0 and a motion score above 0; a motion score above 0 means the chosen mask must at least overlap the predicted box. In addition, the previous frame always goes in, whatever its scores.
An example compares the two memory banks. Suppose we're now processing frame 100, and the target was blocked by a car in frames 94 to 97, with negative object scores throughout:
| Frames in the memory bank | |
|---|---|
| SAM 2 | 0, 94, 95, 96, 97, 98, 99 |
| SAMURAI | 0, 90, 91, 92, 93, 98, 99 |
Of SAM 2's 7 memories, 4 come from the occlusion; SAMURAI skips those four frames and reaches further back for 90 to 93. What memory attention reads is how the target looked the last time it was clearly visible.
Both modules just compute a few more IoUs and make a few more checks at inference time, with no training needed. The paper says that with them added, the running time on an RTX 4090 is the same as the original SAM 2's, but it gives no actual FPS figure.
Discussion
Against SAM 2.1 on the Same Backbone
The fairest comparison is the same set of weights with and without these two modules. The paper tests all four sizes of SAM 2.1 on LaSOT and LaSOT-ext (Table 5). The metric is AUC: take the fraction of tracked boxes whose overlap with the ground truth exceeds each threshold, then the area under the resulting curve.
| Backbone | LaSOT AUC | LaSOT-ext AUC |
|---|---|---|
| T | 66.70 → 69.28 | 52.25 → 55.13 |
| S | 66.47 → 70.04 | 56.11 → 57.99 |
| B | 65.97 → 70.65 | 55.51 → 57.48 |
| L | 68.54 → 74.23 | 58.55 → 61.03 |
Compiled from Table 5 of the paper, SAM 2.1 left of the arrow, SAMURAI right.
All four sizes improve. On LaSOT, the bigger the model, the bigger the gain, from 2.58 for T to 5.69 for L; on LaSOT-ext the gains fall between 1.9 and 2.9 points, with no clear relation to size.
Against Purpose-Trained Trackers
Set side by side with supervised methods, SAMURAI-L reaches an AUC of 74.2 on LaSOT, the same as LoRAT-L, which was trained on the LaSOT training set, while ODTrack-L gets 74.0. The gap opens up on LaSOT-ext. This set of videos was picked specifically for occlusions and small objects, and its categories aren't in LaSOT; SAMURAI-L gets 61.0 against 53.9 for ODTrack-L, the best supervised method in the table, 7.1 higher. On GOT-10k the AO is 81.7, against 78.2 for ODTrack-L.
Zero-shot here refers to not being trained on these tracking datasets. SAM 2.1 itself was trained on large amounts of video and image segmentation data such as SA-V. GOT-10k's rules allow only its own training set, the point being to test how well a tracker generalizes to categories it hasn't seen. SAMURAI's weights have seen far more data than GOT-10k, so its training conditions differ from those of the other methods in the table. The table lists it next to the supervised methods, so keep this in mind when reading the numbers.
How Much Each Module Contributes
| Setting | LaSOT AUC |
|---|---|
| SAM 2.1-L | 68.32 |
| Motion model only | 70.81 |
| Memory selection only | 72.67 |
| Both | 74.23 |
Compiled from Table 3 of the paper.
Memory selection contributes more than the motion model. Replacing the fixed window alone adds 4.35; the motion model on its own adds only 2.49, but stacking the two pushes the score higher still.
The sweep over also agrees with the hand calculation earlier. amounts to memory selection alone, with an AUC of 72.67; 0.15 is best, at 74.23; raising it to 0.5 drops it back to 72.92. With too much weight on the motion score, the model gets led around by the Kalman filter's predictions; once the linear-motion assumption breaks down, it actually picks wrong more often.
Which Cases Benefit Most
The paper breaks the results down by the 14 attributes annotated in LaSOT. On LaSOT-ext, SAMURAI-L improves most on camera motion, from 62.8 to 73.1, and on fast motion, from 46.1 to 50.7; full occlusion and partial occlusion both improve as well. Illumination variation, on the other hand, gets worse, with both the B and L sizes dropping by just over two points.

This figure is exactly the first kind of mistake from the beginning. The target is mostly hidden by the zebra in front, and in the top row SAM 2.1 puts its mask on that front zebra's legs from frame 1300 on. In the bottom row, SAMURAI also boxes too much at frame 1310, but by the very next panel, frame 1320, it is back on the target inside the green box.
Limitations
SAMURAI tracks one target at a time; to track many, you have to open a separate SAM 2 state for each, and the computation grows with the number of targets. The Kalman filter assumes constant-velocity straight-line motion, and every threshold is set by hand, so on videos with very different motion patterns these numbers may not carry over. The official README also states that the code builds on SAM 2's implementation and doesn't yet support real-time streaming input.
Another set of numbers for reference comes from the later SAM 3 paper. Its video object segmentation comparison also lists SAMURAI, using the mask metric J&F, without saying which backbone SAMURAI used. On the long-video LVOSv2, SAMURAI gets 84.2 and SAM 2.1-L 79.6; on MOSEv1, though, it's 72.6 against 77.9, and on DAVIS17 89.9 against 90.7. Under a segmentation metric and on different kinds of video, the benefit of memory filtering doesn't show up everywhere.
Conclusion
SAMURAI changes very little. The masks still come from SAM 2; it just takes one more look at position when choosing among the candidates, and one more look at the scores before storing a memory. The motion score carries only 15% of the weight, yet that's enough to pull the target back when appearance can't separate the candidates; memory filtering keeps errors made during an occlusion from being passed all the way down the video.
If you already have SAM 2, this is an almost free improvement, with no training and no new weights. Those few thresholds and the 15% weight, though, were all tuned on data like LaSOT; for drone footage or sports-field video, it's best to pick a few clips of your own first and sweep the motion weight and memory thresholds again.