segment-anything-model

Generate zero-shot image segmentation masks using point, box, and mask prompts.

Updated Sep 10, 2026
One-click install
npx skills add https://github.com/loteiron/ZeusAgent --skill segment-anything-model-loteiron
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: segment-anything-model
Source: https://github.com/loteiron/ZeusAgent/tree/main/optional-skills/mlops/models/segment-anything-model
Command: npx skills add https://github.com/loteiron/ZeusAgent --skill segment-anything-model-loteiron

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires segment-anything, transformers, torch, and includes references (resource) components.

What problem does it solve? Segmenting objects in images traditionally requires task-specific training data and model fine-tuning. This Skill guides you through Meta AI's Segment Anything Model (SAM) to produce high-quality segmentation masks on any image domain without training, using simple point, box, or mask prompts. ## Core Features & Use Cases - Interactive Prompt-Based Segmentation: Segment objects with foreground/background points, bounding boxes, or previous masks using SamPredictor, with iterative refinement support. - Automatic Mask Generation: Produce all object masks in an image at once with SamAutomaticMaskGenerator, with tunable quality, stability, and density thresholds. - Deployment & Integration: Export to ONNX for browser and edge deployment, or use HuggingFace Transformers (SamModel/SamProcessor) for pipeline integration. - Use Case: Build an annotation tool where a user clicks on an object in an image, and SAM returns a precise binary mask with an IoU quality score, which is then exported as a COCO RLE annotation for training a downstream vision model. ## Quick Start Ask the agent to segment the object at a specific point in your image using SAM with the ViT-H checkpoint and return the best mask with its quality score.

Frequently Asked Questions about segment-anything-model

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I segment an object in an image with SAM?▼

Load a checkpoint with sam_model_registry, create a SamPredictor, call set_image once, then predict with point coordinates and labels (1 for foreground, 0 for background). The predictor returns masks with IoU scores; select the highest-scoring mask.

What is the difference between SAM ViT-B, ViT-L, and ViT-H?▼

ViT-H (2.4 GB) is the slowest but most accurate, ViT-L (1.2 GB) is a middle option, and ViT-B (375 MB) is the fastest with good accuracy. Use ViT-B when GPU memory or inference speed is limited.

SAM vs GroundingDINO for text-prompted segmentation?▼

SAM only accepts geometric prompts (points, boxes, masks) and cannot interpret text. Combine GroundingDINO, which converts text descriptions into bounding boxes, with SAM to generate masks from those boxes for text-prompted segmentation.

Can SAM run on CPU or in the browser?▼

SAM runs on CPU but is significantly slower than on CUDA GPUs. For browser and edge deployment, export the mask decoder to ONNX with the provided export script and run it with ONNX Runtime, computing image embeddings separately.

Why does SAM run out of CUDA memory?▼

The ViT-H checkpoint and large images consume substantial GPU memory. Switch to the ViT-B model, downscale images, call torch.cuda.empty_cache() between batches, or load the model in half precision to reduce memory usage.

When should I not use Segment Anything Model?▼

SAM does not assign class labels, so use YOLO or Detectron2 for real-time detection with categories, and Mask2Former for semantic or panoptic segmentation. For video segmentation with object tracking across frames, use SAM 2 instead.