Back to Skills

segment-anything-model

Foundation model for image segmentation with zero-shot transfer. Use when you need to segment any object in images using points, boxes, or masks as prompts, or automatically generate all object masks in an image.

3,579stars289forksUpdated 2/18/2026

Security Assessment

Safe(100/100)
Security Score100/100

About segment-anything-model

The Segment Anything Model (SAM) is a powerful tool for zero-shot image segmentation, enabling users to segment any object in an image without the need for task-specific training. This model provides flexibility by allowing users to use points, bounding boxes, or previous masks as prompts to segment objects. SAM is designed to work across various image domains without requiring fine-tuning, making it highly versatile and useful in a wide range of applications. It has been trained on a massive dataset of 1.1 billion masks from 11 million images, ensuring high-quality results across different types of images.

FAQ

How do I install the Segment Anything Model?

You can install SAM via GitHub or HuggingFace. For GitHub, use the command 'pip install git+https://github.com/facebookresearch/segment-anything.git'. Optional dependencies like 'opencv-python' and 'pycocotools' can be installed separately.

What are the different model sizes available?

SAM provides three model sizes: ViT-H (most accurate, 2.4GB), ViT-L (medium, 1.2GB), and ViT-B (fastest, 375MB). You can download the models from the provided URLs.

Can I use SAM for real-time object detection?

SAM is designed for zero-shot segmentation and is not optimized for real-time object detection. For real-time detection, consider using YOLO or Detectron2.

What are the requirements for using SAM?

SAM requires PyTorch (>=1.7.0), Transformers (>=4.30.0), and the Segment Anything library. For best performance, it also requires a CUDA-capable device for faster processing.

Is SAM compatible with HuggingFace Transformers?

Yes, SAM can be used with HuggingFace Transformers. You can load the model and processor using 'SamModel.from_pretrained' and 'SamProcessor.from_pretrained', respectively.

Install segment-anything-model

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill