NibblitSeg v1: weights, config, model card
Browse filesFiles changed (3)
- README.mdAdded+77
- config.jsonAdded+34
- model.safetensorsAdded+3
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677---pipeline_tag: image-segmentationtags: - pixel-art - open-vocabulary - part-segmentation - spriteslibrary_name: pytorch---
# NibblitSeg v1
Text-prompted part segmentation for 32×32 pixel art. Give it a sprite and some part names, and it labels every pixel.
**[Project page & demo](https://angais.github.io/nibblitseg/)** · **[Code](https://github.com/Angais/nibblitseg)** · **[Showcase video](https://angais.github.io/nibblitseg/assets/nibblitseg_v1.mp4)**

## Usage
```bashpip install git+https://github.com/Angais/nibblitseg```
```pythonfrom nibblitseg import NibblitSeg, colorize
seg = NibblitSeg.from_pretrained("Angais/NibblitSeg-v1")
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")
seg.segment("sign.png", ["text"])["pixel_counts"] # {'text': 55}seg.segment("jack_o_lantern.png", ["sword"])["pixel_counts"] # {'sword': 0}```
## Files
- `model.safetensors`: network weights (fp16, 20.05M params)- `config.json`: architecture, text encoder id, held-out exam metrics
Part names are embedded with the frozen SigLIP text tower `google/siglip-base-patch16-224`, downloaded on first use.
## Model
- 18-channel pixel-art stem (RGBA, neighbour differences, coordinates), 3-scale conv U-Net, 4 RoPE transformer blocks at the bottleneck, 3-layer query decoder, full-resolution dot-product mask head.- Output: logits `(K+1, H, W)`, class 0 = other / background, 1..K = the queried parts.- Trained on Nibblit's procedurally rendered sprites with per-pixel part labels; best checkpoint at epoch 10.
## Evaluation
Held-out exam of 6,509 sprites never seen in training. Full partition, no subject hint.
| Metric | Score ||---|---:|| Pixel accuracy | 89.6% || Mean IoU | 84.6 || Absent parts → exactly 0 px | 94.3% || Single-part query IoU | 80.2 || Opaque background (canvas acc.) | 95.4% |
| 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 |
## Limitations
- Trained and evaluated on 32×32 sprites only.- Harder on object types it has never seen (77.7% pixel accuracy on unseen programs).- Separates copies you name (`ladybug 1…N`) but does not count on its own.- Names close to 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 first.12345678910111213141516171819202122232425262728293031323334{
"model_type": "nibblitseg",
"version": "1.0",
"arch": {
"text_dim": 768,
"c0": 96,
"c1": 192,
"c2": 320,
"mask_dim": 128,
"num_heads": 8,
"num_bottleneck_layers": 4,
"num_query_layers": 3
},
"siglip_model": "google/siglip-base-patch16-224",
"train_epoch": 10,
"params": 20050010,
"exam_metrics": {
"n_exam": 6509,
"full_with_subj_acc": 89.51,
"full_with_subj_miou": 84.44,
"full_no_subj_acc": 89.63,
"full_no_subj_miou": 84.58,
"full_free_acc": 85.85,
"full_free_miou": 82.73,
"jitter_acc": 90.88,
"jitter_miou": 85.7,
"single_part_iou": 80.17,
"single_part_f1": 83.18,
"distractor_fp_pct": 1.225,
"distractor_exact_zero_pct": 94.3,
"opaque_bg_canvas_acc": 95.42,
"opaque_bg_fg_acc": 90.11
}
}123version https://git-lfs.github.com/spec/v1oid sha256:3a52ce36272c0e19f5cdf76b7b3a733e8215d675a7b4295f42bd0f268ee77e8dsize 40124828README.mdAdded+77
config.jsonAdded+34
model.safetensorsAdded+3