# SAM (2023)

> A model that cuts out whatever you point at, in any image, trained on a billion masks.

Page: https://mralbu.github.io/ai-datasets/p/sam

## Key facts

- Title: Segment Anything
- Authors: Alexander Kirillov, Eric Mintun, Nikhila Ravi, Hanzi Mao, Chloe Rolland, Laura Gustafson, Tete Xiao, Spencer Whitehead, Alexander C. Berg, Wan-Yen Lo, et al.
- Venue: ICCV 2023
- Category: Vision
- Paper: https://www.alphaxiv.org/abs/2304.02643

## Why it matters

Segmentation models had been trained for one dataset's classes. SAM made masks a general tool that works on new kinds of images without retraining, and its dataset was 400 times larger than any before. It became a standard component in labeling tools and in other vision systems.

## The idea

Define segmentation as answering a prompt: a click, a box or a rough mask in, a valid mask out, even when the prompt is ambiguous. A large ViT encodes the image once; a small decoder answers each prompt in about 50 ms. A data engine with the model in the loop produced SA-1B, 1.1 billion masks on 11 million images.

## The result

From a single click it beat the previous interactive model on 16 of 23 unseen datasets, including ADE20K and Cityscapes. Prompted with a detector's boxes on COCO it reached 46.5 mask AP with no COCO training, below a supervised model's 51.0 but rated higher by human judges.

## The data

- [MS COCO (2014)](https://mralbu.github.io/ai-datasets/d/coco.md): 330k everyday scenes with 1.5M labeled objects in 80 categories.
- [ADE20K (2017)](https://mralbu.github.io/ai-datasets/d/ade20k.md): 27,000 scenes where every object, and often its parts, is outlined and named.
- [Cityscapes (2016)](https://mralbu.github.io/ai-datasets/d/cityscapes.md): 5,000 street photos from 50 cities, every pixel labeled as road, car, person, sky and so on.

## Builds on

- [ViT (2020)](https://mralbu.github.io/ai-datasets/p/vit.md)
- [MAE (2021)](https://mralbu.github.io/ai-datasets/p/mae.md)
- [CLIP (2021)](https://mralbu.github.io/ai-datasets/p/clip.md)
- [DETR (2020)](https://mralbu.github.io/ai-datasets/p/detr.md)

## Part of

- [Segmentation](https://mralbu.github.io/ai-datasets/t/segmentation.md) (step 7 of 7)
