At a glance
| Upstream model | nvidia/segformer-b2-finetuned-ade-512-512 (27.5M params, 62.4 GFLOPs, 46.5% SS / 47.5% MS ADE20K mIoU) |
|---|---|
| Browser ONNX repo | Xenova/segformer-b2-finetuned-ade-512-512 β onnx/model_quantized.onnx |
| Pipeline task | image-segmentation (pipeline("image-segmentation", "Xenova/segformer-b2-finetuned-ade-512-512")) |
| Architecture | SegformerForSemanticSegmentation (segformer): MiT-B2 depths: [3, 4, 6, 3], hidden_sizes: [64, 128, 320, 512], patch_sizes: [7, 3, 3, 3], strides: [4, 2, 2, 2], decoder_hidden_size: 768, 512Γ512 preprocessor (do_reduce_labels: true) |
| Output | [{ score: null, label, mask: RawImage }] β folded via per-pixel argmax into 150 ADE20K labels |
| Quantization & size | q8: 28.94 MB (onnx/model_quantized.onnx, 28,939,869 B; fp16 55.72 MB Β· fp32 110.45 MB unused) |
| Runtime & backend | Shared ../../lib/webai.js with Transformers.js 3.7.5 Β· CPU WASM in a module Web Worker |
| License | other β NVIDIA Source Code License (research / non-commercial; see model repo) |
Live 150-class semantic mask lab
Drop, upload, paste, capture a camera snapshot, or pick a curated zero-person scene. Hover or tap the mask canvas to inspect the exact ADE20K class under the cursor, or press any legend pill to isolate that class across the frame.
Camera frames stay strictly on your device. Capture a snapshot to segment every pixel.
Camera idle.
Loading a curated sceneβ¦
Hover or tap the canvas to inspect pixel coordinates and ADE20K class, or select a legend pill below.
Interactive class coverage legend (press to isolate on canvas)
Class area distribution
| ADE20K ID | Class | Category | Pixels | Coverage | Scale tier |
|---|---|---|---|---|---|
| Run segmentation to inspect ADE20K class coverage. | |||||
See inside β 4-stage hierarchical MiT-B2 vs MiT-B0
SegFormer removes positional encodings by using overlapped patch merging (7Γ7 stride 4,
then 3Γ3 stride 2) and efficient sequence-reduction self-attention (sr_ratios:
[8, 4, 2, 1]). All four stage feature maps are projected to a shared width
(decoder_hidden_size: 768 in B2 vs 256 in B0) and fused by a single all-MLP
head before upsampling to image resolution.
| Stage | Stride | Feature map | Patch / SR ratio | Heads | MiT-B2 (depth Β· dim) | MiT-B0 (depth Β· dim) |
|---|
Show the code β epoch-guarded pipeline load in worker.js
Show the code β ADE20K semantic super-category aggregation
Use-case ladder
Basics
Run MiT-B2 input resolution (256β768 px) & area-threshold ablations plus ADE20K super-category and pixel-size histograms.
Practical
Cancellable FIFO batch scene-inventory analyzer with multi-file upload, target ADE20K checklist, and CSV/JSON/Markdown exports.
Wild
Empirical robustness stress suite (low light, motion blur, border frame, downscale, haze, JPEG blockiness) measuring live mIoU retention.
Multi-model
Pit SegFormer-B2 (28.94 MB) head-to-head against sibling SegFormer-B0 (4.42 MB) for per-class pixel IoU & tiny-object gain.