← All models

image-segmentation Β· panoptic Β· vision Β· WASM Β· ~45 MB

DETR panoptic β€” cut a whole scene into labelled pieces

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.

At a glance

ModelXenova/detr-resnet-50-panoptic
Task / pipelineimage-segmentation (panoptic)
ArchitectureResNet-50 backbone + transformer encoder–decoder + mask head, 100 object queries
ClassesCOCO panoptic: 80 "thing" classes (per instance) + 53 "stuff" regions
Quantizationq8 (8-bit) ONNX
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~45 MB, cached after first load
LicenseApache-2.0 (Meta DETR)
Web APIsWebAssembly, Web Workers, Canvas, FileReader β€” all Baseline widely available

Run it

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.

Drop an image here, or click to choose
Two cats sleeping on a pink couch A cozy sunlit bedroom with a bookshelf A riverside at golden hour with a swan and people
0.55

See inside

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.

Parse a scene to see every segment.

Why it matters

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.

Use cases

Basics

One image, colour-coded segments, a things-vs-stuff split β€” feel panoptic parsing first-hand.

Practical

Scene inventory & composition: count instances and measure how much frame each region owns.

Wild

Object extractor β€” click a segment and lift just that instance onto a transparent / new background.

Multi-model

Panoptic region β†’ CLIP: pick a segment and let zero-shot classification describe or re-label it.

How the API works

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.

References