segment-anything-model

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

Updated Jun 7, 2026
One-click install
npx skills add https://github.com/Chensihakniroth/ANAKOT-AGENT --skill segment-anything-model-chensihakniroth
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: segment-anything-model
Source: https://github.com/Chensihakniroth/ANAKOT-AGENT/tree/main/skills/mlops/models/segment-anything
Command: npx skills add https://github.com/Chensihakniroth/ANAKOT-AGENT --skill segment-anything-model-chensihakniroth

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 provides operational guidance for Meta AI's Segment Anything Model (SAM), which produces object masks on any image domain without fine-tuning, using simple point, box, or mask prompts. ## Core Features & Use Cases - Interactive Segmentation: Segment objects with foreground/background point clicks, bounding boxes, or combined prompts, with iterative refinement using previous mask logits. - Automatic Mask Generation: Produce all object masks in an image at once with tunable quality, stability, and density thresholds. - Deployment & Integration: Export to ONNX for browser and edge inference, use HuggingFace Transformers pipelines, or extend with GroundingDINO for text-prompted segmentation and SAM 2 for video. - Use Case: Build an annotation tool where a user clicks an object in a photo, and SAM returns a pixel-accurate mask that is exported as COCO RLE for training a downstream detection model. ## Quick Start Ask the agent to segment the object at a given point in an image using the SAM ViT-H checkpoint and return the highest-scoring 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 once, then predict with point coordinates and labels or a bounding box. With multimask_output enabled, select the mask with the highest score.

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

ViT-H is the largest at 2.4 GB with the best accuracy but slowest speed, ViT-L is a medium 1.2 GB option, and ViT-B is the smallest at 375 MB and fastest. Use ViT-B when GPU memory or latency is constrained.

SAM vs GroundingDINO for text-prompted segmentation?▼

SAM alone does not accept text prompts; it only takes points, boxes, or masks. Combine GroundingDINO, which converts text descriptions into bounding boxes, with SAM to generate masks from those boxes.

Can SAM segment objects in videos?▼

The original SAM processes images only and has no tracking. Use SAM 2, which adds a streaming memory architecture to propagate masks across video frames after prompting on an initial frame.

Why does SAM run out of CUDA memory?▼

The ViT-H checkpoint and large images can exceed GPU memory. Switch to the ViT-B model, resize images to a maximum dimension, clear the CUDA cache between images, or load the model in half precision.

Why does automatic mask generation miss small objects?▼

The default grid density and minimum region area filter out small regions. Increase points_per_side, enable crop_n_layers for multi-scale detection, and lower min_mask_region_area to retain tiny masks.