segment-anything-model

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

1|Updated Jun 19, 2026
One-click install
npx skills add https://github.com/Lento47/arcana-community --skill segment-anything-model-lento47
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: segment-anything-model
Source: https://github.com/Lento47/arcana-community/tree/main/skills/mlops/models/segment-anything
Command: npx skills add https://github.com/Lento47/arcana-community --skill segment-anything-model-lento47

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 without fine-tuning, using simple point, box, or mask prompts. ## Core Features & Use Cases - Interactive Segmentation: Generate masks from foreground/background point clicks, bounding boxes, or combined prompts with iterative refinement. - Automatic Mask Generation: Produce all object masks in an image at once with configurable 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 returns a pixel-accurate mask with a quality score, which is then exported in 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 call predict with point coordinates and labels. The predictor returns masks with quality scores, and you select the highest-scoring mask.

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 and fastest. Use ViT-B when GPU memory or inference speed is limited.

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 for text-prompted segmentation.

Can SAM run on CPU or only on GPU?▼

SAM can run on CPU by loading the model without calling .to("cuda"), though inference will be significantly slower. For limited GPU memory, use the ViT-B checkpoint, half precision, or export to ONNX for lighter deployment.

Why does SAM run out of CUDA memory during inference?▼

CUDA out-of-memory errors occur because ViT-H requires substantial VRAM, 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.

When should I use SAM 2 instead of SAM?▼

Use SAM 2 for video segmentation tasks, since it adds a streaming memory architecture that tracks objects across frames. The original SAM processes individual images only and has no temporal tracking capability.