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

> A promptable image segmentation model: a heavy image encoder runs once, then a light decoder turns points, boxes or masks into object masks in milliseconds.

## Reach for it when

- need to cut out a subject from a photo quickly
- isolate objects before 3d reconstruction
- want masks from a click or a box
- label parts of a splat or image interactively

## How it works

A ViT image encoder computes an embedding once per image. A prompt encoder converts clicks, boxes or rough masks into tokens, and a lightweight mask decoder attends between the prompt tokens and the embedding to predict several candidate masks with predicted quality scores, handling ambiguity such as part versus whole. The model was trained on a very large mask dataset built with a model-in-the-loop data engine. An automatic mode prompts a regular grid of points and filters the resulting masks by predicted IoU, stability under thresholding and non-maximum suppression, producing masks for everything in the image. Since the decoder is cheap, interactive use is possible in a browser after the embedding step.

## When to use it

Choose it for object masks to isolate subjects before reconstruction, to build [Visual Hull (Shape from Silhouette)](https://texelatlas.vercel.app/t/visual-hull.md) silhouettes or to label splats. Prefer [SAM 2](https://texelatlas.vercel.app/t/sam2.md) for video or multi-view propagation of masks, and plain thresholding when the background is controlled.

## Cost

medium — Encoder is heavy (about a hundred milliseconds or more on a GPU for large variants); prompts are cheap afterwards.

## Failure modes

- Fine structures and thin boundaries are rounded off
- Masks are not semantically labelled, so class names need another model
- Ambiguous prompts return the wrong granularity (part or whole)
- No temporal consistency across frames or views

## Dataflow

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

## Presets

### SAM automatic mask generator defaults (json-params; parameter preset)

```json
{
  "points_per_side": 32,
  "pred_iou_thresh": 0.88,
  "stability_score_thresh": 0.95,
  "stability_score_offset": 1,
  "box_nms_thresh": 0.7,
  "crop_n_layers": 0,
  "min_mask_region_area": 0
}
```

Attribution: Parameter names follow facebookresearch/segment-anything (Apache-2.0); values are the SamAutomaticMaskGenerator defaults, written for this index.

## Lineage

- extended by [SAM 2](https://texelatlas.vercel.app/t/sam2.md)

## Combines with

- [Visual Hull (Shape from Silhouette)](https://texelatlas.vercel.app/t/visual-hull.md): Per-view SAM masks give the silhouettes that visual hull carving intersects.

## Sources

1. [primary] Alexander Kirillov, Eric Mintun, Nikhila Ravi, Hanzi Mao, Chloe Rolland, Laura Gustafson, Tete Xiao, Spencer Whitehead, Alexander C. Berg, Wan-Yen Lo, Piotr Dollár, Ross Girshick (2023) Segment Anything. arXiv preprint (cs.CV). https://arxiv.org/abs/2304.02643 (verified via arxiv on 2026-11-29)
2. [implementation] facebookresearch (2023) facebookresearch/segment-anything. https://github.com/facebookresearch/segment-anything License: Apache-2.0. (verified via github on 2026-11-29)
3. [tutorial] Meta AI Segment Anything project page. aidemos.meta.com. https://aidemos.meta.com/segment-anything (verified via http on 2026-11-29)

## Cite this entry

Texel. "Segment Anything (SAM)." https://texelatlas.vercel.app/t/segment-anything/ (accessed 2026-12-01).
