TL;DR
SAM 2 (Segment Anything Model 2) is a unified foundation model that extends promptable visual segmentation from static images to the temporal domain of video. By utilizing a novel streaming memory architecture, SAM 2 achieves state-of-the-art accuracy in real-time, requiring 3x fewer human interactions for video segmentation than previous methods while being 6x faster than the original SAM on image tasks.
What Problem Does This Paper Address?
The original Segment Anything Model (SAM) revolutionized computer vision by providing a "foundation model" capable of segmenting any object in an image via simple prompts like clicks or boxes. However, the real world is dynamic. Applying image-level segmentation to video is traditionally difficult because objects move, deform, disappear behind occlusions, and reappear.
Existing video object segmentation (VOS) tools often lacked the "segment anything" generality, were too slow for real-time use, or required tedious frame-by-frame manual correction. The authors sought to create a universal system that treats an image simply as a single-frame video, providing a seamless, interactive experience for segmenting objects across time.
Methods
SAM 2 introduces a streaming transformer architecture designed for real-time processing. Key components include:
- Memory Bank & Attention: Unlike the original SAM, SAM 2 maintains a "memory" of the target object’s past appearances and user interactions. A memory attention module allows the model to "look back" at previous frames to maintain a consistent "masklet" (a spatio-temporal segmentation) even when an object is temporarily hidden.
- Promptable Visual Segmentation (PVS): The model allows users to provide prompts (clicks, boxes, or masks) on any frame. These prompts can define a new object or refine an existing prediction. The model then propagates these changes forward and backward through the video.
- Occlusion Prediction: A new dedicated output head predicts the likelihood that an object is currently visible, helping the model handle "disappearing" objects gracefully.
- The Data Engine: To train such a powerful model, the team built an interactive "data engine." Humans used evolving versions of SAM 2 to annotate data; the model's failures were used to identify "hard" cases for the next round of training, creating a virtuous cycle of improvement.
Datasets
The paper introduces the Segment Anything Video (SA-V) dataset, which is a massive leap in scale:
- SA-V: Contains 35.5 million masks across 50.9k videos. This is 53x more masks than any previous video segmentation dataset.
- Training Mix: The model was trained on a combination of SA-V, the original SA-1B image dataset, and several internal and open-source video datasets (like MOSE and YouTube-VOS).
- Evaluation: The authors tested zero-shot performance across 17 video datasets and 37 image datasets to ensure the model generalizes to unseen environments.
Key Insights and Ideas
- Memory is the "Secret Sauce": By treating video as a sequence where the current frame attends to a memory bank of past features, the model can resolve ambiguities (like which "white car" to track) that would baffle a frame-by-frame approach.
- Images are just 1-frame Videos: By designing the architecture for video first, the authors created a more efficient image segmenter. When the memory bank is empty, SAM 2 behaves like a faster, more accurate version of the original SAM.
- Efficiency via Hiera: The model uses a hierarchical "Hiera" image encoder. This allows it to use multi-scale features (seeing both the "big picture" and fine details) while remaining fast enough for real-time applications (~44 FPS on an A100).
Key Results
- Superior Accuracy: SAM 2 outperforms previous state-of-the-art video models (like Cutie and XMem++) across diverse benchmarks, often with significantly less user input.
- Interaction Efficiency: In interactive settings, SAM 2 reaches higher accuracy with 3x fewer clicks than prior approaches.
- Image Performance: On static image benchmarks, SAM 2 is not only more accurate than the original SAM but also 6x faster.
- Fairness: Evaluation across diverse geographic locations and demographic groups showed minimal performance discrepancy, suggesting robust generalization.
Limitations and Future Work
Despite its power, the authors acknowledge several areas for improvement. The model can still lose track of objects in extremely crowded environments or if an object disappears for a very long time. Tracking very thin or intricate parts of fast-moving objects remains a challenge, and the model may fail to propagate segments across abrupt camera cuts in edited videos. Finally, while SAM 2 processes each object separately, future versions could benefit from inter-object communication to better handle collisions and occlusions.
Summary updated