segment-anything-model

Segment objects in images using point, box, or mask prompts with Meta's SAM model.

1|Updated Mar 12, 2026
One-click install
npx skills add https://github.com/kaminocorp/hermes-alpha-hunter --skill segment-anything-model-kaminocorp
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: segment-anything-model
Source: https://github.com/kaminocorp/hermes-alpha-hunter/tree/main/skills/mlops/models/segment-anything
Command: npx skills add https://github.com/kaminocorp/hermes-alpha-hunter --skill segment-anything-model-kaminocorp

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Manually labeling objects in images for segmentation tasks is slow and requires task-specific model training. This Skill provides zero-shot image segmentation using Meta's Segment Anything Model, letting you isolate any object with simple point or box prompts without fine-tuning. ## Core Features & Use Cases - Interactive Segmentation: Generate masks from point, bounding box, or combined prompts using SamPredictor, with support for iterative refinement via previous mask inputs. - 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 edge deployment, serve via FastAPI or Gradio, and extend with GroundingDINO for text-prompted segmentation or SAM 2 for video. - Use Case: Build an annotation tool where a user clicks an object in a photo and instantly receives a high-quality binary mask with IoU and stability scores, ready to export as COCO RLE for training a downstream vision model. ## Quick Start Load the SAM ViT-H checkpoint with SamPredictor, set your image, and segment the object at point coordinates (500, 375) to get its mask.

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 on your RGB image, then call predict with point coordinates and labels. The model returns masks with quality scores, and you select the highest-scoring one.

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

ViT-H is the largest at 2.4GB with the best accuracy but slowest inference. ViT-B is 375MB and fastest with good accuracy, while ViT-L sits in between at 1.2GB. Choose based on your GPU memory and speed requirements.

Can SAM segment objects from text descriptions?▼

SAM alone only accepts point, box, or mask prompts, not text. Combine it with GroundingDINO, which converts text prompts into bounding boxes that SAM then turns into masks.

Does SAM work for video segmentation?▼

The original SAM processes single images only. For video, use SAM 2, which adds a streaming memory architecture to track and propagate masks across frames from an initial prompt.

Why does SAM run out of CUDA memory?▼

The ViT-H model requires significant VRAM, especially with large images. Switch to the ViT-B checkpoint, resize images to a maximum dimension, call torch.cuda.empty_cache() between images, or use half precision.

When should I use YOLO or Mask2Former instead of SAM?▼

Use YOLO or Detectron2 for real-time object detection with class labels, and Mask2Former for semantic or panoptic segmentation with categories. SAM produces class-agnostic masks and is best for prompt-based or automatic segmentation without predefined classes.