TL;DR
This paper introduces "Segment Anything" (SA), a new foundation model for image segmentation that can generalize to unseen tasks and data distributions through prompt engineering. They achieve this with a novel promptable segmentation task, a powerful yet efficient model (SAM), and the largest segmentation dataset to date (SA-1B) containing over 1 billion masks.
What Problem Does This Paper Address?
The field of computer vision, particularly image segmentation, has been limited by the need for task-specific models and large, annotated datasets for each new problem. While foundation models have revolutionized NLP by enabling zero-shot generalization through prompting, computer vision has lagged behind, especially in segmentation. The challenge is to create a general-purpose segmentation model that can adapt to diverse tasks and data without requiring extensive retraining or task-specific fine-tuning. This requires a new task formulation, a capable model architecture, and a massive, diverse dataset.
Methods
The SA project is built around three core components:
- Promptable Segmentation Task: The goal is to predict a valid segmentation mask given any segmentation prompt (e.g., points, boxes, text). This task is designed to be general enough for pre-training and to enable zero-shot transfer.
- Segment Anything Model (SAM): This model consists of three parts:
- An image encoder (based on a pre-trained Vision Transformer, ViT-H) that creates an image embedding.
- A prompt encoder that embeds various prompt types (points, boxes, text).
- A lightweight mask decoder that efficiently combines the image and prompt embeddings to predict segmentation masks. A key innovation is making SAM "ambiguity-aware" by designing it to output multiple masks for a single prompt, allowing it to handle ambiguous inputs naturally.
- Data Engine: To create the massive dataset, they developed a "data engine" that iteratively improves the model and uses it for data collection. This engine has three stages: assisted-manual, semi-automatic, and fully automatic mask generation.
Datasets
- SA-1B: A newly introduced dataset containing 11 million licensed and privacy-respecting images and over 1.1 billion high-quality segmentation masks. This dataset is significantly larger than existing segmentation datasets, with 400x more masks than the next largest. The masks were generated automatically by SAM.
- Evaluation Datasets: The authors evaluated SAM on a suite of 23 diverse segmentation datasets, including egocentric, microscopy, X-ray, underwater, aerial, simulation, driving, stereo, and fisheye images, to test its zero-shot transfer capabilities.
Key Insights and Ideas
- Prompting as a Universal Interface: The paper demonstrates that a "promptable" task can serve as a powerful general-purpose interface for segmentation, allowing a single model to adapt to various downstream tasks through prompt engineering, similar to how foundation models work in NLP.
- Ambiguity-Awareness is Crucial: Designing SAM to output multiple masks for ambiguous prompts is key to its robustness and ability to handle real-world scenarios where a single point might refer to multiple objects.
- Data Engine for Scale: The success of foundation models hinges on massive datasets. The authors show that a data engine, where the model itself assists in data collection, is an effective strategy for generating segmentation masks at an unprecedented scale.
- Zero-Shot Performance is Impressive: SAM's ability to perform well on tasks and datasets it was not explicitly trained on, often competitively with or even surpassing supervised methods, highlights the power of this foundation model approach.
Key Results
- SA-1B Dataset: The creation of SA-1B, the largest segmentation dataset by far (1.1B masks on 11M images), is a major contribution.
- SAM Performance:
- On a single-point prompt evaluation across 23 datasets, SAM achieved competitive results, often outperforming prior interactive segmentation methods like RITM.
- In human evaluations, SAM's masks were consistently rated higher than baseline methods, even when automatic metrics (like IoU) didn't fully capture quality due to ambiguity.
- For zero-shot edge detection on BSDS500, SAM produced reasonable edge maps, outperforming older zero-shot methods.
- In zero-shot object proposal generation on LVIS v1, SAM performed remarkably well, outperforming a strong detector on medium and large objects.
- For zero-shot instance segmentation, SAM produced higher quality masks than ViTDet in human studies, despite lower AP scores, suggesting it avoids dataset-specific biases.
- SAM demonstrated zero-shot text-to-mask capabilities, segmenting objects based on text prompts, with additional point prompts often fixing failures.
Limitations and Future Work
- Not Perfect: SAM can miss fine structures, hallucinate small disconnected components, and doesn't always produce boundaries as crisply as more specialized, computationally intensive methods.
- Real-time Performance: While the mask decoder is fast, the overall performance isn't real-time when using a heavy image encoder.
- Text-to-Mask Exploratory: The text-to-mask task is presented as exploratory and not entirely robust, though it's expected to improve.
- Domain-Specific Tools: For specific domains, specialized tools might still outperform SAM.
- Prompt Engineering for Complex Tasks: Designing simple prompts for semantic and panoptic segmentation remains an open challenge.
- Future Work: The authors envision SAM being composed into larger systems, enabling new applications and further research into foundation models for computer vision. They also suggest that smaller image encoders might be preferred in certain settings.
Summary updated