← All models

object-detection · vision · WASM · ~160 MB

DETR — find and box every object in an image

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.

At a glance

ModelXenova/detr-resnet-50
Task / pipelineobject-detection
ArchitectureResNet-50 backbone + transformer encoder–decoder, 100 object queries
Classes80 COCO categories (person, car, dog, chair, bottle…)
Quantizationq8 (8-bit) ONNX
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~160 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 Detect. DETR runs once at a low floor; the score slider then filters the boxes live 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
0.50

See inside

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.

Run detection to see the raw boxes.

Why it matters

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.

Use cases

Basics

One image, labelled boxes, a threshold slider — feel detection first-hand.

Practical

Privacy redaction — detect a class and blur or black-box it on-device.

Wild

Live webcam object counter, with a sample-scan fallback when there's no camera.

Multi-model

DETR boxes → click one → SlimSAM returns its exact pixel mask.

How the API works

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.

References