TL;DR
Efficient-SAM2 is a post-training acceleration framework that speeds up the Segment Anything Model 2 (SAM2) by exploiting "sparse perception." By routing background regions through a lightweight shortcut and pruning redundant memory tokens, it achieves a 1.68× speedup on the SAM2.1-L model with only a 1.0% accuracy drop, requiring just one hour of training on a single GPU.
What Problem Does This Paper Address?
While Segment Anything Model 2 (SAM2) is the gold standard for video object segmentation (VOS), its heavy architecture makes real-time deployment difficult. The computational bottlenecks are primarily two-fold:
- The Image Encoder: It processes every pixel in every frame with equal intensity, even though the user usually only cares about a specific foreground object. This results in massive unnecessary computation applied to background regions.
- Memory Attention: To maintain temporal consistency, SAM2 constantly "re-reads" previous frames from a memory bank. This involves redundant computations over thousands of tokens that do not change significantly from frame to frame.
Existing "Efficient SAM" variants usually involve retraining the entire model from scratch with a smaller backbone. Efficient-SAM2 takes a different path: post-training acceleration. It keeps the powerful pre-trained weights but introduces "smart skips" to avoid useless work, inspired by the observation that SAM2 exhibits a sparse perception pattern similar to biological vision.
Methods
The authors introduce two primary modules designed to eliminate task-irrelevant computations by adaptively focusing on object regions.
1. Object-Aware Sparse Window Routing (SWR)
The image encoder (the part that "sees" the frame) is usually unaware of what the user is looking for. SWR bridges this gap by using the previous frame's mask decoder as a guide to tell the encoder where to focus in the next frame.
- The Router: It identifies "object-relevant" windows and "background" windows based on spatio-temporal consistency and perceptual saliency.
- The Shortcut: Background windows are routed away from the computationally heavy Transformer blocks into a "lightweight shortcut branch" (consisting of just two linear layers). This branch aligns background features without the heavy cost of self-attention.
2. Object-Aware Sparse Memory Retrieval (SMR)
When SAM2 looks back at its memory, it usually processes every single token. However, the authors found that only a small subset of tokens actually contribute to the segmentation.
- Saliency Reuse: SMR identifies the most important ("salient") tokens the first time a frame is added to memory.
- Sparse Masking: For all subsequent frames, the model only retrieves those specific salient tokens, skipping the rest. Because video frames are temporally consistent, these salient regions don't need to be re-calculated every time, drastically reducing memory attention overhead.
Datasets and Training
The model was evaluated on several standard Video Object Segmentation (VOS) benchmarks, including SA-V (Segment Anything Video), DAVIS 2017, and MOSE (designed for complex scenes with heavy occlusions).
Crucially, the training overhead is minimal. Unlike distillation methods that take days on GPU clusters, Efficient-SAM2’s shortcut branch is so small that it only required 30 unlabeled videos from the SA-V training set and was trained in one hour on a single RTX A6000.
Key Results
- Speed: On the SAM2.1-L (Large) model, the system achieved a 1.68× end-to-end speedup. Individually, SWR provided a 1.83× boost to the encoder, and SMR provided a 1.78× boost to memory attention.
- Accuracy: The performance drop is negligible. On the SA-V test set, accuracy (J&F score) only fell from 79.8 to 78.8.
- Efficiency vs. Baselines: Efficient-SAM2 outperformed other acceleration techniques like ToMe (Token Merging) and ALGM, which often suffer from severe accuracy degradation in dense segmentation tasks.
Limitations and Future Work
- Shallow Layer Limitations: Currently, SWR is only applied to the deeper stages of the image encoder. Applying it to the very first layers caused a larger accuracy drop because the model hadn't yet formed a clear "idea" of where the object was.
- Motion Sensitivity: While the authors use "mask dilation" to account for objects moving between frames, extremely fast-moving objects might still escape the predicted object windows, leading to tracking failures.
- Hardware Specifics: While theoretical FLOPs are reduced significantly, actual "wall-clock" speedups depend on how well the hardware handles sparse operations and irregular memory access. Future work could involve optimizing these kernels for edge devices.
Summary updated