Text-prompted part segmentation for 32×32 pixel art. Name the parts, and it labels every pixel. 20M parameters, one forward pass, runs on a laptop GPU or a CPU.
Explore
Real outputs on held-out exam sprites the model never saw in training, scored against ground truth. Hover a part to isolate it.
Capabilities
List every part and each opaque pixel goes to exactly one of them.
Everything else stays "other". Parts that aren't there come back empty.
Prompt ladybug 1, ladybug 2, … and every copy gets its own mask.
Segment the hands, measure their angles. 334 of 336 held-out clocks read exactly.
Quickstart
Weights download from Hugging Face on first use. CUDA is used when available, otherwise CPU.
pip install git+https://github.com/Angais/nibblitseg
from nibblitseg import NibblitSeg, colorize seg = NibblitSeg.from_pretrained() # Angais/NibblitSeg-v1 # name every part: each opaque pixel goes to one of them out = seg.segment("padlock.png", ["shackle", "body", "keyhole"], force_assign_foreground=True) print(out["pixel_counts"]) # {'shackle': 146, 'body': 319, 'keyhole': 22} colorize("padlock.png", out["part_map"]).save("padlock_parts.png") # ask for one part; absent parts come back empty seg.segment("sign.png", ["text"])["pixel_counts"] # {'text': 55} seg.segment("jack_o_lantern.png", ["sword"])["pixel_counts"] # {'sword': 0}
nibblitseg examples/sprites/christmas_tree.png --parts star branches ornaments trunk --all --out tree.png
part_map (H, W) int32 0 = other / background, 1..K = index into parts masks {part: (H, W) bool} pixel_counts {part: int} probs (K+1, H, W) float32 softmax
More in examples/: quickstart.py and read_clock.py, with the sprites shown on this page.
Results
6,509 exam sprites never seen in training. Full partition with no subject hint: the model gets the list of part names and must label every pixel.
| Exam group | Sprites | Pixel acc. | mIoU |
|---|---|---|---|
| Text on signs, labels, screens | 1,308 | 99.4% | 98.8 |
| Clocks | 336 | 97.3% | 94.7 |
| Groups of identical copies | 1,275 | 94.7% | 93.9 |
| Two objects in a spatial relation | 984 | 91.7% | 89.8 |
| New combinations of known objects | 800 | 86.7% | 76.7 |
| Objects from programs never seen in training | 1,816 | 77.7% | 66.3 |
| Other settings | Score |
|---|---|
| Single-part query (one name, no subject) | 80.2 IoU |
| With a subject hint | 89.5% acc. |
| Simulated generator noise (σ = 5/255) | 90.9% acc. |
| Opaque background instead of transparency | 95.4% canvas acc. |
| Absent-part false-positive pixels | 1.2% |
Group rows are per-sprite averages from a re-run of the exam (6,519 sprites with ≥ 2 parts); headline numbers are from the official evaluation. Clock reading uses a small angle-measuring script on top of the masks.
Limitations
The network is resolution-agnostic, but it was trained and evaluated on 32×32 sprites only.
On objects from programs it never saw, pixel accuracy drops to 77.7%. Part boundaries on complex sprites can be rough.
It separates copies when you name them (ladybug 1…N). Over-asking (ladybug 1…12) and counting non-empty masks is only 22% exact.
A name that resembles a real part can grab it: asking a tree for "wings" returns its leaves. Opaque drop shadows on outside tilesets get labelled as parts unless removed.
google/siglip-base-patch16-224), downloaded on first use.