segment-anything-model

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Segmenting objects in images normally requires task-specific training data and model fine-tuning. This Skill provides operational guidance for Meta AI's Segment Anything Model (SAM), enabling zero-shot segmentation of any object in any image domain 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 via SamAutomaticMaskGenerator. - Deployment & Integration: Export to ONNX for browser and edge deployment, use HuggingFace Transformers, or build annotation tools, FastAPI services, and Gradio interfaces. - Use Case: Building a dataset labeling pipeline: run automatic mask generation over raw images, filter masks by predicted IoU above 0.9, and export annotations in COCO RLE format for training a downstream detection model. ## Quick Start Use the segment-anything skill to segment the object at point (500, 375) in my image 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 (1 for foreground, 0 for background). With multimask_output enabled, SAM returns three mask candidates with scores so you can pick the best.

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 only accepts geometric prompts like points and boxes, not text. Combine GroundingDINO to convert a text caption into bounding boxes, then feed those boxes into SAM to produce masks for the described objects.

Can SAM be used for video segmentation?▼

SAM processes individual 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 after prompting on an initial frame.

Why does SAM run out of CUDA memory?▼

The ViT-H checkpoint is 2.4 GB and large images increase memory pressure. Switch to the ViT-B model, resize images to a maximum dimension around 1024 pixels, call torch.cuda.empty_cache() between images, or run inference in half precision.

How do I fix SAM missing small objects in automatic mode?▼

Increase points_per_side for a denser prompt grid, enable crop_n_layers for multi-scale processing, and lower min_mask_region_area. Alternatively, split the image into overlapping patches and run the mask generator on each patch.