image-segmentation Β· panoptic Β· vision Β· WASM Β· ~45 MB
Panoptic segmentation answers "what is every pixel?" in one pass β and it counts. Two cats become two separate segments (that's the "things" half), while the couch, the wall and the floor come back as labelled background regions (the "stuff" half). Drop an image and watch the scene fall apart into colour-coded, named pieces, entirely on your device.
| Model | Xenova/detr-resnet-50-panoptic |
|---|---|
| Task / pipeline | image-segmentation (panoptic) |
| Architecture | ResNet-50 backbone + transformer encoderβdecoder + mask head, 100 object queries |
| Classes | COCO panoptic: 80 "thing" classes (per instance) + 53 "stuff" regions |
| Quantization | q8 (8-bit) ONNX |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~45 MB, cached after first load |
| License | Apache-2.0 (Meta DETR) |
| Web APIs | WebAssembly, Web Workers, Canvas, FileReader β all Baseline widely available |
Pick or drop an image and hit Parse scene. One forward pass returns every segment; the opacity slider blends the colour map over the photo without re-running the model.
Panoptic segmentation merges two jobs. Things are countable objects β each instance gets its own mask, so two cats are two rows, not one "cat" class. Stuff is amorphous background β sky, grass, a wall β one region per class. Every pixel is assigned to exactly one segment (we resolve overlaps by the strongest mask), so the areas below are a true partition of the image. This table is the raw parse the model returned.
| # | label | kind | score | area |
|---|
Boxes tell you where a thing roughly is; a semantic map tells you what kind of thing each pixel is. Panoptic gives you both at once β pixel-exact masks that still count instances β which is exactly what "understand this whole scene" needs. Doing it in the browser turns scene parsing into a local function call: private, offline, free per call.
person instance while leaving the background untouched, before an image is ever shared.One image, colour-coded segments, a things-vs-stuff split β feel panoptic parsing first-hand.
Scene inventory & composition: count instances and measure how much frame each region owns.
Object extractor β click a segment and lift just that instance onto a transparent / new background.
Panoptic region β CLIP: pick a segment and let zero-shot classification describe or re-label it.
Panoptic parsing is a one-liner with Transformers.js β the default call on this model returns the segment set:
import { pipeline } from "@huggingface/transformers";
const segment = await pipeline(
"image-segmentation",
"Xenova/detr-resnet-50-panoptic",
); // downloads + caches ~45 MB once
const segments = await segment(imageURL);
// β [{ score: 0.99, label: "cat", mask: RawImage }, β¦] β per-instance + per-region
// each mask is a single-channel image; a pixel value near 255 means "in this segment"
This page runs that call once inside a Web Worker (so the control UI never janks), then
composites the per-segment masks into one colour-coded overlay by assigning each pixel to its
strongest mask. The opacity slider just re-blends the cached overlay β it never re-runs
inference. The canvas carries an aria-label and every segment is also listed as
accessible text, because canvas pixels aren't exposed to assistive tech on their own.