segment-anything-model

Segment objects in images using point, box, or mask prompts with zero-shot transfer.

2|Updated Jan 10, 2026
One-click install
npx skills add https://github.com/Shubh2310-developer/ENGUNITYCORE --skill segment-anything-model-shubh2310-developer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: segment-anything-model
Source: https://github.com/Shubh2310-developer/ENGUNITYCORE/tree/main/.claude/skills/multimodal-segment-anything
Command: npx skills add https://github.com/Shubh2310-developer/ENGUNITYCORE --skill segment-anything-model-shubh2310-developer

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? Manually creating segmentation masks for images is slow and requires task-specific model training. This Skill provides operational guidance for Meta's Segment Anything Model (SAM), enabling zero-shot segmentation of any object in any image domain without fine-tuning. ## Core Features & Use Cases - Prompt-Based Segmentation: Generate masks from point clicks, bounding boxes, or previous masks using SamPredictor with ViT-B, ViT-L, or ViT-H checkpoints. - Automatic Mask Generation: Produce all object masks in an image at once with SamAutomaticMaskGenerator, with tunable quality and stability thresholds. - Deployment & Integration: Export to ONNX for browser and edge deployment, or use HuggingFace Transformers with SamModel and SamProcessor. - Use Case: Build an interactive annotation tool where a user clicks on an object in an image and SAM returns a pixel-accurate mask, which is then exported as COCO RLE annotations 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 or box prompts. The predict method returns masks, scores, and logits; select the mask with the highest score.

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

ViT-B is the smallest at 375MB and fastest, ViT-L is medium at 1.2GB, and ViT-H is the largest at 2.4GB with the best accuracy. Choose based on your GPU memory and speed requirements.

SAM vs GroundingDINO for text-prompted segmentation?

SAM alone does not accept text prompts; it requires points, boxes, or masks. Combine GroundingDINO with SAM to convert text descriptions into bounding boxes, then feed those boxes to SAM for mask generation.

Can SAM run on CPU or only GPU?

SAM can run on CPU by not calling .to("cuda"), but inference is significantly slower, especially for the image encoder. For limited GPU memory, use the ViT-B model or export to ONNX for optimized deployment.

Why does SAM run out of CUDA memory during inference?

CUDA out of memory occurs with large models like ViT-H or large images. Switch to ViT-B, reduce image resolution, call torch.cuda.empty_cache() between images, or use half precision with sam.half().

When should I use SAM 2 instead of SAM?

Use SAM 2 for video segmentation tasks, since it adds streaming memory and object tracking across frames. Standard SAM processes individual images only and has no temporal awareness.