---
id: "sam2"
title: "SAM 2"
aliases: [Segment Anything Model 2]
domain: "capture"
stage: "capture"
realtime: "interactive"
platforms: [cuda, python]
year_introduced: 2024
inputs: [photos]
outputs: [visibility-mask]
style: "both"
dynamic: "dynamic"
cost: "medium"
authority: "Ravi et al., 2024"
url: "https://texelatlas.vercel.app/t/sam2/"
sources_verified_at: "2026-11-29"
---
# SAM 2 (Ravi et al., 2024)

> Extends Segment Anything to video with a streaming memory that propagates prompted masks across frames, also usable on image sets as a sequence.

## Reach for it when

- need object masks across video frames
- mask the same object in every turntable photo
- propagate a prompted mask through ordered images
- segmenting each frame separately flickers

## How it works

Like SAM, SAM 2 has an image encoder, a prompt encoder and a mask decoder, but frames are processed as a stream. A memory bank stores embeddings of recent frames and of prompted frames along with predicted masks. Each new frame's features cross-attend to this memory through memory attention before decoding, so the mask follows the object across motion and short occlusions. Users can add corrective clicks on any frame, and the model updates the track. Images are treated as a one-frame video. Training combined a data engine with a large video segmentation dataset. A hierarchical image encoder makes the model faster than the original SAM at comparable image quality.

## When to use it

Choose it to propagate object masks across video frames or ordered multi-view captures, e.g. to mask a turntable sequence for [Visual Hull (Shape from Silhouette)](https://texelatlas.vercel.app/t/visual-hull.md) or splat training. Prefer [Segment Anything (SAM)](https://texelatlas.vercel.app/t/segment-anything.md) for single unrelated images, and masks from 3D-aware methods when views are sparse and unordered.

## Cost

medium — Real-time-ish per-frame on a modern GPU for small variants; memory use grows with the stored frame count.

## Failure modes

- Identity switches when similar objects cross or after long occlusions
- Drift on fast motion, motion blur or thin objects
- Unordered or wide-baseline multi-view sets break the temporal-memory assumption
- Boundary quality is limited for hair and transparent edges

## Dataflow

- Inputs: photos
- Outputs: visibility-mask
- Platforms: cuda, python

## Lineage

- extends [Segment Anything (SAM)](https://texelatlas.vercel.app/t/segment-anything.md)

## Sources

1. [primary] Nikhila Ravi, Valentin Gabeur, Yuan-Ting Hu, Ronghang Hu, Chaitanya Ryali, Tengyu Ma, Haitham Khedr, Roman Rädle, Chloe Rolland, Laura Gustafson, Eric Mintun, Junting Pan, Kalyan Vasudev Alwala, Nicolas Carion, Chao-Yuan Wu, Ross Girshick, Piotr Dollár, Christoph Feichtenhofer (2024) SAM 2: Segment Anything in Images and Videos. arXiv preprint (cs.CV). https://arxiv.org/abs/2408.00714 (verified via arxiv on 2026-11-29)
2. [implementation] facebookresearch (2024) facebookresearch/sam2. https://github.com/facebookresearch/sam2 License: Apache-2.0. (verified via github on 2026-11-29)

## Cite this entry

Texel. "SAM 2." https://texelatlas.vercel.app/t/sam2/ (accessed 2026-12-01).
