Image editing & upscalingApache-2.0Python

Segment Anything (SAM)

Meta’s promptable segmentation model — click to cut out any object.

Stars
55K
Forks
6.4K
Open issues
596
Last commit
2024-09-18

Live from the GitHub API · updated 2026-10-15

What is Segment Anything (SAM)?

Segment Anything produces object masks from points, boxes or automatic grid prompts. It powers selection tools in many editors and pipelines. Its successor, SAM 2, adds video segmentation.

Key features

  • Point and box prompts for masks
  • Automatic mask generation for whole images
  • Three model sizes (ViT-B/L/H)
  • ONNX export for browser use

System requirements

Platforms
Windows · macOS · Linux
GPU
NVIDIA recommended
Python
3.8+

How to install Segment Anything (SAM)

Summarized from the project’s README. Projects change quickly — check the GitHub page for the latest instructions.

pip

  1. 1
    Install from GitHub.
    pip install git+https://github.com/facebookresearch/segment-anything.git
  2. 2
    Download a checkpoint (e.g. ViT-H) from the README and generate masks.
    python scripts/amg.py --checkpoint sam_vit_h_4b8939.pth --model-type vit_h --input image.jpg --output masks/

Strengths

  • Foundation model for segmentation
  • Permissive license

Limitations

  • Masks only — no generation
  • Large checkpoints

Segment Anything (SAM) alternatives compared

SoftwareStarsLicensePlatformsVRAM
Segment Anything (SAM)

Meta’s promptable segmentation model — click to cut out any object.

55KApache-2.0—
SAM 2

Segment Anything for images and video, with object tracking.

20KApache-2.0—
BiRefNet

High-resolution dichotomous segmentation — state-of-the-art background removal.

4.3KMIT—
Upscayl

Free desktop app that upscales images with AI.

50.6KAGPL-3.0—
Real-ESRGAN

Practical image and video super-resolution models.

37.1KBSD-3-Clause—
GFPGAN

Blind face restoration for old and low-quality photos.

37.7KApache-2.0—

FAQ

Is Segment Anything (SAM) free?

Yes — Segment Anything (SAM) is open-source software released under the Apache-2.0 license. Check the license (and any model weight licenses) before commercial use.

Does Segment Anything (SAM) run on Windows, Mac and Linux?

Segment Anything (SAM) supports: Windows, macOS, Linux.

What hardware do I need for Segment Anything (SAM)?

NVIDIA recommended

How do I install Segment Anything (SAM)?

1. Install from GitHub. 2. Download a checkpoint (e.g. ViT-H) from the README and generate masks.

What are the best Segment Anything (SAM) alternatives?

Popular alternatives include SAM 2, BiRefNet, Upscayl, Real-ESRGAN. See the comparison table on this page.

Can I use Segment Anything (SAM) online without installing it?

If you just want results, AiLoft runs top image models such as GPT Image 2.5 and Nano Banana Pro in the browser — no GPU or setup required.

Skip the install — generate images in your browser

No GPU, drivers or Python needed. Use GPT Image 2.5 and Nano Banana Pro online and compare them side by side.