Image editing & upscalingApache-2.0Python

SAM 2

Segment Anything for images and video, with object tracking.

Stars
20K
Forks
2.6K
Open issues
488
Last commit
2026-05-30

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

What is SAM 2?

SAM 2 extends Segment Anything to video: prompt an object once and it is tracked and masked across frames. It is faster than SAM on images and is used for rotoscoping and video editing pipelines.

Key features

  • Promptable image and video segmentation
  • Object tracking across frames
  • Multiple model sizes

System requirements

Platforms
Linux · Windows · macOS
GPU
NVIDIA recommended
Python
3.10+
Notes
PyTorch 2.5.1+ per the README.

How to install SAM 2

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

From source

  1. 1
    Clone and install.
    git clone https://github.com/facebookresearch/sam2.git
    cd sam2
    pip install -e .
  2. 2
    Download checkpoints.
    cd checkpoints && ./download_ckpts.sh

Strengths

  • Works on video
  • Faster than SAM

Limitations

  • Developer-oriented

SAM 2 alternatives compared

SoftwareStarsLicensePlatformsVRAM
SAM 2

Segment Anything for images and video, with object tracking.

20KApache-2.0—
Segment Anything (SAM)

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

55KApache-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 SAM 2 free?

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

Does SAM 2 run on Windows, Mac and Linux?

SAM 2 supports: Linux, Windows, macOS.

What hardware do I need for SAM 2?

NVIDIA recommended

How do I install SAM 2?

1. Clone and install. 2. Download checkpoints.

What are the best SAM 2 alternatives?

Popular alternatives include Segment Anything (SAM), BiRefNet, Upscayl, Real-ESRGAN. See the comparison table on this page.

Can I use SAM 2 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.