kalarislabs/research-agent-skills/segment-anything-model
Claude Code and agent skill by kalarislabs/research-agent-skills
- community
Checking that the SKILL.md file is still in the repository.
Foundation model for image segmentation with zero-shot transfer. Use when you need to segment any object in images using points, boxes, or masks as prompts, or automatically generate all object masks in an image.
Install
npx vskill@latest install kalarislabs/research-agent-skills/segment-anything-modelSKILL.md
The same SKILL.md was published earlier as kalarislabs/research-agent-skills/segment-anything-model.
Segment Anything Model (SAM)
Comprehensive guide to using Meta AI's Segment Anything Model for zero-shot image segmentation.
When to use SAM
Use SAM when:
- Need to segment any object in images without task-specific training
- Building interactive annotation tools with point/box prompts
- Generating training data for other vision models
- Need zero-shot transfer to new image domains
- Building object detection/segmentation pipelines
- Processing medical, satellite, or domain-specific images
Key features:
- Zero-shot segmentation: Works on any image domain without fine-tuning
- Flexible prompts: Points, bounding boxes, or previous masks
- Automatic segmentation: Generate all object masks automatically
- High quality: Trained on 1.1 billion masks from 11 million images
- Multiple model sizes: ViT-B (fastest), ViT-L, ViT-H (most accurate)
- ONNX export: Deploy in browsers and edge devices
Use alternatives instead:
- YOLO/Detectron2: For real-time object detection with classes
- Mask2Former: For semantic/panoptic segmentation with categories
- GroundingDINO + SAM: For text-prompted segmentation
- SAM 2: For video segmentation tasks
Quick start
Installation
Download checkpoints
Basic usage with SamPredictor
HuggingFace Transformers
Core concepts
Model architecture
Model variants
| Model | Checkpoint | Size | Speed | Accuracy | |
|---|---|---|---|---|---|
| ViT-H | vit_h | 2.4 GB | Slowest | Best | |
| ViT-L | vit_l | 1.2 GB | Medium | Good | |
| ViT-B | vit_b | 375 MB | Fastest | Good |
Prompt types
| Prompt | Description | Use Case | |
|---|---|---|---|
| Point (foreground) | Click on object | Single object selection | |
| Point (background) | Click outside object | Exclude regions | |
| Bounding box | Rectangle around object | Larger objects | |
| Previous mask | Low-res mask input | Iterative refinement |
Interactive segmentation
Details, code examples and parameter tables: references/interactive-segmentation.md. Read it when this step applies.
Automatic mask generation
Basic automatic segmentation
Customized generation
Filtering masks
Batched inference
Multiple images
Multiple prompts per image
ONNX deployment
Export model
Use ONNX model
Common workflows
Workflow 1: Annotation tool
Workflow 2: Object extraction
Workflow 3: Medical image segmentation
Output format
Mask data structure
COCO RLE format
Performance optimization
GPU memory
Speed optimization
Common issues
| Issue | Solution | |
|---|---|---|
| Out of memory | Use ViT-B model, reduce image size | |
| Slow inference | Use ViT-B, reduce points_per_side | |
| Poor mask quality | Try different prompts, use box + points | |
| Edge artifacts | Use stability_score filtering | |
| Small objects missed | Increase points_per_side |
References
- [Advanced Usage](references/advanced-usage.md) - Batching, fine-tuning, integration
- [Troubleshooting](references/troubleshooting.md) - Common issues and solutions
Resources
- GitHub: https://github.com/facebookresearch/segment-anything
- Paper: https://arxiv.org/abs/2304.02643
- Demo: https://segment-anything.com
- SAM 2 (Video): https://github.com/facebookresearch/segment-anything-2
- HuggingFace: https://huggingface.co/facebook/sam-vit-huge
Agent operating procedure
- Check the environment. Confirm GPU memory, model checkpoint and licence, framework versions and input formats.
- Pin down the inputs. Confirm formats, identifiers and parameters from the data or the user. Ask rather than guess any value that changes the result.
- Run a small version first. Run inference on a single sample at low resolution or short length first.
- Execute the full task using the instructions and references above.
- Validate the result. Inspect outputs qualitatively and with task metrics; check licence restrictions for generated content.
- Report. State what was run (versions, commands, parameters), what was checked, and what is still uncertain.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/segment-anything-model/SKILL.md
Popularity
- Repository stars
- 1
- 7-day trend score
- 8
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/kalarislabs/research-agent-skills/segment-anything-model)