图像编辑与放大Apache-2.0Python

Segment Anything (SAM)

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

Star 数
55K
Fork 数
6.4K
未关闭 Issue
596
最近提交
2024-09-18

数据来自 GitHub API · 更新于 2026-10-15

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.

主要功能

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

系统要求

平台
Windows · macOS · Linux
显卡
NVIDIA recommended
Python
3.8+

如何安装 Segment Anything (SAM)

根据项目 README 整理。开源项目更新很快,请以 GitHub 页面上的最新说明为准。

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/

优势

  • Foundation model for segmentation
  • Permissive license

不足

  • Masks only — no generation
  • Large checkpoints

Segment Anything (SAM) 替代品对比

软件Star 数许可证平台显存
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—

常见问题

Segment Anything (SAM) 免费吗?

是的——Segment Anything (SAM) 是开源软件,采用 Apache-2.0 许可证。商用前请确认软件及模型权重的许可条款。

Segment Anything (SAM) 支持 Windows、Mac 和 Linux 吗?

Segment Anything (SAM) 支持:Windows, macOS, Linux。

运行 Segment Anything (SAM) 需要什么配置?

NVIDIA recommended

如何安装 Segment Anything (SAM)?

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

Segment Anything (SAM) 有哪些好的替代品?

常见替代品包括 SAM 2, BiRefNet, Upscayl, Real-ESRGAN,详见本页对比表。

可以不安装、在线使用 Segment Anything (SAM) 吗?

如果只想要结果,AiLoft 可在浏览器中运行 GPT Image 2.5、Nano Banana Pro 等顶级图像模型,无需显卡和配置。

不想安装?直接在浏览器里生成图片

无需显卡、驱动或 Python。在线使用 GPT Image 2.5 和 Nano Banana Pro,并排对比效果。