object-detection · vision · WASM · ~160 MB
DETR treats detection as a set-prediction problem: one forward pass, a fixed set of "object queries," and out come labelled boxes with confidence scores. Drop an image and watch it draw a box around every thing it recognises — 80 everyday COCO classes, entirely on your device.
| Model | Xenova/detr-resnet-50 |
|---|---|
| Task / pipeline | object-detection |
| Architecture | ResNet-50 backbone + transformer encoder–decoder, 100 object queries |
| Classes | 80 COCO categories (person, car, dog, chair, bottle…) |
| Quantization | q8 (8-bit) ONNX |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~160 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 Detect. DETR runs once at a low floor; the score slider then filters the boxes live without re-running the model.
DETR emits a fixed set of predictions each pass — one per "object query." Each carries a class
(or "no object") plus a box as four numbers. Below is the raw list for the boxes above the
current threshold: the label, the softmax confidence, and the box as x, y, width,
height in the image's own pixels. No post-processing beyond the score filter — this is
what the model actually returned.
| # | label | score | x | y | w | h |
|---|
Object detection used to mean a cloud API, an upload, and a per-image bill. DETR in the browser turns "where is everything in this picture?" into a local function call — private, offline, free per call, and fast enough to run on a live camera.
person or screen in an image and blur it client-side before it's ever shared.One image, labelled boxes, a threshold slider — feel detection first-hand.
Privacy redaction — detect a class and blur or black-box it on-device.
Live webcam object counter, with a sample-scan fallback when there's no camera.
DETR boxes → click one → SlimSAM returns its exact pixel mask.
Detection is a one-liner with Transformers.js. The boxes come back in pixel coordinates:
import { pipeline } from "@huggingface/transformers";
const detect = await pipeline(
"object-detection",
"Xenova/detr-resnet-50",
); // downloads + caches ~160 MB once
const output = await detect(imageURL, { threshold: 0.5, percentage: false });
// → [{ label: "cat", score: 0.998, box: { xmin, ymin, xmax, ymax } }, …]
// percentage:false gives pixel coordinates; true gives 0–1 fractions
This page runs the model once at a low floor threshold (0.05) inside a Web Worker, caches every box, and filters the cached list as you drag the slider — so the slider is instant and never re-runs inference. The canvas is drawn at the image's natural resolution and scaled by CSS, so the boxes stay pixel-accurate.