sam3-segmentation

This was mostly written by Opus 5.5 and not thoroughly checked by a human. It works on my machine, but haven't tested it elsewhere.
An agent skill that outlines objects in photos with Meta's SAM 3, run on your
own NVIDIA GPU, and keeps everything it produces checkable.

Same six agents on the same corn photo, without tools (left half) and with this
skill (right half). Counts are each run's full set; nobody has checked these
outlines (details, data). Photo:
ImageNet validation image ILSVRC2012_val_00000408; copyright belongs to its
original photographer and it is not covered by this repository's licence. It
will be removed on request.
Ask your coding agent (Claude Code, Codex, Cursor, Pi, OpenCode and about 75
others) to "outline every kernel", "cut out the dog" or "count the seeds", and
this skill gives it the model, the commands and the rules to do it properly:
- Quick calls: every instance of a phrase ("all the jars"), more objects like
an example box, one object from a click or a box, or "segment everything".
- A careful workflow for many small objects or parts (kernels, seeds, cells,
insects): overlapping close-up crops, every raw candidate saved, score checks,
review sheets and flags, recorded and reversible review decisions, boundary
refinement, PNG and COCO RLE exports, and a zoomable viewer.
- Honest output: masks are reported as model proposals, never as verified
ground truth, with what is uncertain listed.
Install
Pick one. Each installs the same skill folder.
# Any agent (Claude Code, Codex, Cursor, OpenCode, Gemini CLI, ...). Needs Node.js 22+.
npx skills add lillyguisnet/sam3-segmentation # add -g for every project
# Claude Code plugin, with updates (Claude Code 2.1.275 or later):
/plugin install sam3-segmentation --marketplace lillyguisnet/sam3-segmentation
# No Node.js: copy the folder yourself (--target claude, codex or pi)
git clone https://github.com/lillyguisnet/sam3-segmentation
python3 sam3-segmentation/install.py --target claude
Then ask your agent in plain words. The skill loads by itself when the request
fits; you can also name it (/sam3-segmentation in Claude Code, where a plugin
install shows it as /sam3-segmentation:sam3-segmentation, or $sam3-segmentation
in Codex). For example:
Outline every visible kernel in corn.jpg, and the whole ears separately. Keep
overlapping levels, check every region, and tell me what is uncertain. Ask me
before any large download.
What you need
| To... | You need |
|---|
| Run the model | Linux (or Windows WSL2) with an NVIDIA GPU (12-24 GB memory suggested), uv, about 11 GB of disk, and your own accepted access to facebook/sam3 on Hugging Face |
| See a demo of the viewer and file formats, on generated shapes (no segmentation) | Any machine with uv; no GPU, model or account |
Without an NVIDIA GPU, the skill cannot segment anything: the model does not
run on CPU or Apple GPUs. The agent asks before
installing anything. It never asks for your Hugging Face token: you log in
yourself with hf auth login. The Python environments are created outside the
skill folder (in ~/.local/share/sam3-segmentation/), so updates and several
installed copies reuse them.
Demo without a GPU (no segmentation)
The model needs an NVIDIA GPU. Without one, you can only run a demo: it
draws generated shapes, runs the review and export tools on them, and opens the
viewer, so you can see what the results look like before installing anything
large. It does not segment your photos and does not use the model.
S=~/.claude/skills/sam3-segmentation # wherever the skill was installed
sh "$S/scripts/run" base segment.py demo --out /tmp/sam3-demo
sh "$S/scripts/run" base python -m http.server 8000 --bind 127.0.0.1 --directory /tmp/sam3-demo/export
Open http://127.0.0.1:8000 to see the viewer on the generated shapes.
Does it work?
On corn, with six different agents. Six models (GPT-6 Luna, GPT-6.1 Sol,
GPT-6 Astra, Claude Haiku 5.5, Sonnet 5 and Opus 5.5) each ran the full workflow
alone, with only the skill and a corn photo. Each finished with a full set of
kernel proposals: