segment-anything-model

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

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

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 training task-specific models on labeled datasets. This Skill lets you segment any object in any image domain without fine-tuning, using Meta AI's Segment Anything Model with simple point or box prompts. ## Core Features & Use Cases - Interactive Segmentation: Generate masks from foreground/background points, bounding boxes, or previous masks using SamPredictor with ViT-B, ViT-L, or ViT-H checkpoints. - Automatic Mask Generation: Produce all object masks in an image at once with SamAutomaticMaskGenerator, with tunable quality and stability thresholds. - Deployment & Integration: Export to ONNX for 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 instantly receives a high-quality segmentation mask with a predicted IoU score, ready to export as COCO RLE for training data generation. ## Quick Start Use the segment-anything-model skill to segment the object at point (500, 375) in my image 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_coords and point_labels. Set multimask_output=True to get three mask candidates and select the one with the highest score.

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

ViT-B is the smallest at 375MB and fastest with good accuracy, ViT-L is 1.2GB with medium speed, and ViT-H is 2.4GB, slowest but most accurate. Choose based on your GPU memory and latency requirements.

SAM vs YOLO vs Mask2Former for segmentation tasks?▼

SAM provides zero-shot class-agnostic segmentation from geometric prompts without training. Use YOLO or Detectron2 for real-time detection with class labels, Mask2Former for semantic segmentation with categories, and GroundingDINO plus SAM for text-prompted segmentation.

Can SAM run on CPU or only GPU?▼

SAM runs on CPU but inference is significantly slower, especially for the image encoder. For CPU or limited VRAM, use the ViT-B model, reduce image resolution, or export to ONNX for optimized runtime performance.

Why does SAM return empty or incorrect masks?▼

Incorrect masks usually result from wrong coordinate order (points must be x,y not row,col), BGR instead of RGB images, or ambiguous prompts. Add background points with label 0, combine box and point prompts, or use iterative refinement with previous mask logits.

Does SAM support video segmentation?▼

The original SAM processes images only and has no tracking across frames. For video segmentation, use SAM 2, which adds a streaming memory architecture to propagate masks through video frames from initial prompts.