facebookresearch/segment-anything

The repository provides code for running inference with the SegmentAnything Model (SAM), links for downloading the trained model checkpoints, and example...

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 5 minutes ago
Added to GitGenius on January 2nd, 2024
Created on March 23rd, 2023
Open Issues & Pull Requests: 594 (+0)
Number of forks: 6,354
Total Stargazers: 54,684 (+0)
Total Subscribers: 334 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 207.8 days
Mean response time: 261.4 days
90th percentile: 612.5 days
Tracked items: 155

How this project is maintained

Around half of the issues opened in the past year never receive a reply. 100% of open issues come from outside the core team, so the backlog reflects real-world use rather than internal planning. Only 1% of issues opened in the past year have been closed.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 536
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 915 days
Stale 30+ days: 535
Stale 90+ days: 531

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • how-to (29)
  • question (29)
  • discussion (14)
  • enhancement (11)
  • installation (5)
  • bug (3)
  • documentation (1)
  • help wanted (1)

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

The Segment Anything Model (SAM) is a foundation model developed by Meta AI Research that performs high-quality object segmentation from various input prompts including points, boxes, and other visual cues. The model can generate masks for individual objects based on prompts or automatically produce masks for all objects within an image. SAM was trained on an extensive dataset comprising 11 million images and 1.1 billion masks, enabling strong zero-shot performance across diverse segmentation tasks.

The repository provides complete inference code for running SAM, downloadable trained model checkpoints, and example notebooks demonstrating practical usage. Three model variants are available with different backbone architectures: ViT-H (default), ViT-L, and ViT-B, allowing users to select based on their computational constraints and accuracy requirements. The codebase requires Python 3.8 or higher, PyTorch 1.7 or later, and TorchVision 0.8 or later, with CUDA support strongly recommended for optimal performance.

The repository includes multiple usage pathways for practitioners. Users can employ SAM with specific prompts to generate masks for targeted objects, use automatic mask generation to segment entire images without prompts, or run inference directly from the command line. The project provides example notebooks covering prompt-based segmentation and automatic mask generation workflows. Additionally, SAM's lightweight mask decoder can be exported to ONNX format for deployment in diverse environments, including web browsers, as demonstrated by the interactive demo available at segment-anything.com/demo.

A React-based web application is included in the demo folder, showcasing how to run mask prediction with the exported ONNX model in browser environments with multithreading support. The repository also provides utilities for working with the underlying SA-1B dataset, including methods to load mask annotations stored in JSON format and decode masks from COCO RLE format into binary representations.

The README indicates that development has progressed to Segment Anything Model 2 (SAM 2), which extends the original model to handle both images and videos. SAM 2 employs a transformer architecture with streaming memory for real-time video processing and was trained on the SA-V dataset, described as the largest video segmentation dataset available. The original SAM repository remains actively maintained as a reference implementation, with the model licensed under Apache 2.0 to facilitate research and commercial applications.