segment-anything-model

Generate object masks in images using point, box, or automatic prompts with SAM.

14|5|Updated Apr 9, 2026
One-click install
npx skills add https://github.com/MLT-OSS/hermes-agent-go --skill segment-anything-model-mlt-oss
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: segment-anything-model
Source: https://github.com/MLT-OSS/hermes-agent-go/tree/main/skills/mlops/models/segment-anything
Command: npx skills add https://github.com/MLT-OSS/hermes-agent-go --skill segment-anything-model-mlt-oss

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires segment-anything, transformers>=4.30.0, torch>=1.7.0, 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 provides guidance for using Meta's Segment Anything Model (SAM) to segment any object in any image with zero-shot transfer, using simple point, box, or mask prompts. ## Core Features & Use Cases - Interactive Segmentation: Segment objects with point clicks, bounding boxes, or combined prompts, with iterative refinement using previous masks. - Automatic Mask Generation: Generate all object masks in an image at once with tunable quality, stability, and density thresholds. - Deployment & Integration: Export to ONNX for edge deployment, use HuggingFace Transformers, or build FastAPI/Gradio services. - Use Case: Build an annotation tool where a user clicks on an object in an image and SAM instantly produces a high-quality segmentation mask, which is then exported as COCO RLE format for training a downstream detection model. ## Quick Start Use the segment-anything skill to segment the object at a clicked point 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 SAM checkpoint with sam_model_registry, create a SamPredictor, call set_image on your RGB image, then predict with point coordinates or a bounding box. The predictor returns masks with quality scores; select the highest-scoring mask.

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

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

SAM vs GroundingDINO for text-prompted segmentation?

SAM alone only accepts geometric prompts like points and boxes, not text. Combine GroundingDINO for text-to-box detection with SAM for box-to-mask segmentation to achieve text-prompted segmentation.

Can SAM be used for video segmentation?

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

Why does SAM run out of CUDA memory?

The ViT-H model requires significant GPU memory, 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.

Why does automatic mask generation miss small objects?

The default grid of points may be too sparse for small objects. Increase points_per_side, enable crop_n_layers for multi-scale processing, and lower min_mask_region_area to retain small masks.