segment-anything-model

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

5|2|Updated May 26, 2026
One-click install
npx skills add https://github.com/perasyudha/Nyxora --skill segment-anything-model-perasyudha
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: segment-anything-model
Source: https://github.com/perasyudha/Nyxora/tree/main/packages/core/playbooks/mlops/models/segment-anything
Command: npx skills add https://github.com/perasyudha/Nyxora --skill segment-anything-model-perasyudha

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's Segment Anything Model (SAM), which produces high-quality object masks on any image domain without fine-tuning, using simple point, box, or mask prompts. ## Core Features & Use Cases - Interactive Segmentation: Generate masks from foreground/background points, 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 deployment, use HuggingFace Transformers, or build FastAPI/Gradio annotation services. - Use Case: Build an annotation tool where a user clicks an object in an image, and SAM returns a pixel-accurate mask that is exported as COCO RLE for training a downstream detection model. ## Quick Start Ask the AI to segment the object at a specific point in your image using SAM with the 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 (1 for foreground, 0 for background). Set multimask_output=True to get three candidate masks and select the one with the highest score.

How to generate all object masks in an image automatically?

Use SamAutomaticMaskGenerator with your SAM model and call generate(image). Tune points_per_side, pred_iou_thresh, and stability_score_thresh to control mask count and quality. Each result includes the mask, bounding box, area, and predicted IoU.

SAM vs GroundingDINO for text-prompted segmentation?

SAM alone only accepts geometric prompts like points and boxes, not text. Combine GroundingDINO, which converts text descriptions into bounding boxes, with SAM to produce masks from natural language queries.

Which SAM model size should I use: ViT-B, ViT-L, or ViT-H?

ViT-H (2.4GB) gives the best accuracy but is slowest, ViT-B (375MB) is fastest with good quality, and ViT-L (1.2GB) is a middle option. Use ViT-B when GPU memory is limited or inference speed matters.

Why does SAM run out of CUDA memory?

The ViT-H model and large images can exceed GPU memory. Switch to the ViT-B checkpoint, downscale images, call torch.cuda.empty_cache() between batches, or convert the model to half precision with sam.half().

Can SAM segment objects in videos?

The original SAM processes single images only. For video segmentation with object tracking across frames, use SAM 2, which adds a streaming memory architecture and propagates masks through video frames.