facebookresearch

facebookresearch/sam2

Jupyter Notebook Apache-2.0 AI & ML

The repository provides code for running inference with the Meta Segment Anything Model 2 (SAM 2), links for downloading the trained model checkpoints, and example notebooks that show how to use the model.

19.5k stars
2.5k forks
slow
GitHub +36 / week

19.5k

Stars

2.5k

Forks

482

Open issues

11

Contributors

AI Analysis

SAM 2 is Meta's foundation model for promptable visual segmentation in both images and videos, extending the original Segment Anything Model with streaming memory architecture for real-time video processing. It is specifically designed for researchers, computer vision practitioners, and developers building segmentation applications who need a versatile pre-trained model; it is not a general-purpose consumer application. The project benefits organizations integrating advanced segmentation capa...

AI & ML Research Project Discovery value: 3/10
Documentation 8/10
Activity 7/10
Community 9/10
Code quality 5/10

Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.

Overall score 8/10

AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.

computer-vision segmentation foundation-model video-processing transformer
Popular Niche/specialized use case Well documented Actively maintained Production ready
Deep Analysis · Based on README and public signals
3w ago

Meta's SAM 2 extends promptable image segmentation to video with streaming memory architecture

SAM 2 is a foundation model for promptable visual segmentation in both images and videos, released by Meta FAIR. It accepts point, box, or mask prompts and propagates segmentation masks through video frames using a transformer with streaming memory. Primary users include computer vision researchers, robotics teams, medical imaging groups, and developers building annotation pipelines or interactive segmentation tools. Its appeal is broad: it unifies image and video segmentation under one model and is backed by the SA-V dataset, the largest video segmentation dataset publicly released at the time of launch.

Origin

SAM 2 is the successor to the original Segment Anything Model (SAM, 2023), also from Meta FAIR. SAM 2 adds video support and a streaming memory module, launching in July 2024 with SAM 2.1 improvements released in September 2024.

Growth

The repository accumulated ~19K stars rapidly after its July 2024 launch, driven by Meta's reputation in CV research, the wide applicability of zero-shot segmentation, and a live interactive demo. Growth has since plateaued (6 stars in the last 7 days as of June 2026), consistent with a mature research release rather than an actively growing product. The ecosystem spawned forks in SAM 3, SAM-Audio, and SAM-3D-Objects, suggesting the project has become a research foundation for adjacent work.

In production

Adoption is evidenced by an interactive public demo (sam2.metademolab.com), a downloadable dataset (SA-V), and training/fine-tuning code release — signals that Meta intends production-grade usability. The 2,482 forks and three documented derivative repositories (SAM 3, SAM-Audio, SAM-3D-Objects) suggest substantial secondary research and engineering use. However, direct evidence of third-party production deployments at scale is not verifiable from repository metadata alone.

Code analysis
Architecture

Appears to use a transformer-based architecture with a Hiera backbone and a streaming memory module enabling temporal propagation across video frames. Multiple model size variants (tiny, small, base+, large) are documented. Likely uses custom CUDA kernels for post-processing, as the README documents optional CUDA extension compilation steps.

Tests

Not documented in README. No mention of unit tests, CI badges, or test suites in the README excerpt.

Maintenance

Last push was 2026-05-30, approximately 3 weeks before the evaluation date — indicating active maintenance. The repository has received multiple substantive updates (SAM 2.1 checkpoints, torch.compile support, training code release, web demo release), suggesting ongoing engineering investment rather than archival status.

Honest verdict

ADOPT IF: you need zero-shot, promptable segmentation in images or videos and can operate on GPU hardware with PyTorch 2.5+; especially suitable for annotation pipelines, robotics perception, and research requiring video object tracking without class-specific training. AVOID IF: you need lightweight CPU-only deployment, class-specific semantic segmentation without interactive prompts, or production SLAs where model latency and infrastructure complexity are constraints. MONITOR IF: you are evaluating SAM 3 or derivative models for longer-term integration, as Meta's lineage continues to evolve and SAM 2 may be superseded for some use cases.

Independent dimensions

Mainstream potential

7/10

Technical importance

9/10

Adoption evidence

7/10

Risks
  • GPU and CUDA dependency creates a hard barrier for edge deployment or CPU-only environments.
  • Meta may shift primary development focus to SAM 3 or successor models, potentially reducing investment in SAM 2 maintenance over time.
  • Custom CUDA kernel compilation adds installation friction, particularly on Windows, and may break with future PyTorch or CUDA version updates.
  • The model requires large checkpoint downloads (multiple variants), which complicates deployment in bandwidth-constrained or air-gapped environments.
  • Zero-shot performance, while strong, may degrade significantly on domain-specific data (e.g., medical imaging, satellite imagery) without fine-tuning, requiring additional training infrastructure.
Prediction

SAM 2 will likely remain a widely cited research baseline and practical tool for annotation and video segmentation through 2026-2027, but its role as the primary Meta segmentation model may gradually shift to SAM 3 and specialized variants.

0 found this helpful

Newsletter

Get analyses like this every Monday

Free weekly digest of the most interesting open-source discoveries.

Languages

Jupyter Notebook
97.8%
Python
2.1%
Cuda
0%
Shell
0%
Dockerfile
0%

Information

Language
Jupyter Notebook
License
Apache-2.0
Last updated
1mo ago
Created
24mo ago
Analyzed with
anthropic/claude-haiku-4-5

Stars over time

Loading…

Contributors over time

Top 100 contributors only — repos with more will plateau at 100.

Loading…

Recent releases

No releases published yet.

Similar repos

facebookresearch

facebookresearch/sam3

SAM 3 is Meta's foundation model for segmentation in images and videos using...

10.9k Python AI & ML
facebookresearch

facebookresearch/sam-audio

SAM-Audio is Meta's foundation model for isolating and separating specific...

3.6k Python AI & ML
facebookresearch

facebookresearch/sam-3d-body

SAM 3D Body is a promptable model for single-image 3D human mesh recovery that...

3.4k Python AI & ML
facebookresearch

facebookresearch/sam-3d-objects

SAM 3D Objects is a foundation model for reconstructing 3D geometry, texture,...

7.1k Python AI & ML
vs. alternatives
facebookresearch/sam (SAM 1)

SAM 1 covers image-only segmentation; SAM 2 extends this to video with streaming memory. SAM 2 is the intended successor and is likely a strict superset of SAM 1 capability for most workflows.

facebookresearch/sam3

SAM 3 (10K+ stars) appears to be a successor or parallel branch targeting 3D or broader modalities, suggesting Meta continues investing in the lineage rather than treating SAM 2 as a terminal release.

ultralytics/ultralytics (FastSAM / SAM integration)

Ultralytics integrates SAM and SAM 2 into its ecosystem with an easier installation path and YOLO-based tracking. Preferred for users wanting a unified object detection + segmentation pipeline without managing standalone SAM 2 installation.

openmmlab/mmsegmentation

MMSeg is a broader segmentation framework with many architectures. SAM 2 is more specialized in promptable zero-shot segmentation; MMSeg is preferred for supervised semantic segmentation tasks.

IDEA-Research/Grounded-SAM

Grounded-SAM combines open-vocabulary detection (Grounding DINO) with SAM for text-prompted segmentation. SAM 2 alone requires visual prompts; Grounded-SAM variants add text-driven workflows on top of SAM 2.