segment-anything-model

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

Updated May 13, 2026
One-click install
npx skills add https://github.com/superfhp/lumi-agent-body --skill segment-anything-model-superfhp
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: segment-anything-model
Source: https://github.com/superfhp/lumi-agent-body/tree/main/skills/mlops/models/segment-anything
Command: npx skills add https://github.com/superfhp/lumi-agent-body --skill segment-anything-model-superfhp

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 guidance for using Meta's Segment Anything Model (SAM) to segment any object in any image domain without fine-tuning, 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 mask outputs. - Automatic Mask Generation: Generate all object masks in an image at once with configurable quality thresholds, grid density, and multi-scale crops. - Deployment & Integration: Export to ONNX for browser and edge deployment, batch process multiple images, and integrate with HuggingFace Transformers. - Use Case: Build an annotation tool where users click on objects to generate segmentation masks, then export the masks as COCO RLE annotations to create training data for a custom 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 SAM checkpoint with sam_model_registry, create a SamPredictor, call set_image on your RGB image, then call predict with point coordinates and labels. Set multimask_output to 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?▼

ViT-H is the largest at 2.4GB with the best accuracy but slowest speed, ViT-L is a medium 1.2GB option, and ViT-B is the smallest at 375MB with the fastest inference. 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 with SAM to convert text descriptions into bounding boxes, then feed those boxes to SAM to produce masks.

Can SAM be used for video segmentation?▼

The original SAM processes individual images only and does not track objects across frames. Use SAM 2, which adds a streaming memory architecture for video segmentation and object tracking across frames.

Why does SAM run out of CUDA memory?▼

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

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

Increase points_per_side for denser prompt grids, enable crop_n_layers for multi-scale processing, and lower min_mask_region_area. Alternatively, process the image in overlapping patches and merge the resulting masks.