← All models

object-detection · vision · WASM · ~22 MB

RT-DETR — real-time detection with no NMS clean-up

RT-DETR is DETR made fast enough for live video. It keeps the transformer, set-prediction idea — one forward pass, no anchor boxes — but redesigns the encoder and query selection so it emits one clean box per object directly, with no non-maximum-suppression pass. Same 80 COCO classes as classic DETR, a tenth of the model size, and quick enough to run your webcam. All on your device.

At a glance

Modelonnx-community/rtdetr_r18vd (ONNX of PekingU/rtdetr_r18vd)
Task / pipelineobject-detection
ArchitectureResNet-18 backbone + efficient hybrid encoder + IoU-aware query selection — an end-to-end, NMS-free real-time DETR
Classes80 COCO categories (person, car, dog, chair, bottle…)
Quantizationq8 (8-bit) ONNX
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~22 MB, cached after first load
LicenseApache-2.0 (Baidu RT-DETR)
Web APIsWebAssembly, Web Workers, Canvas, getUserMedia, FileReader — all Baseline widely available

Run it

Pick or drop an image and hit Detect — or start the webcam and watch it box the world in real time. RT-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

RT-DETR's decoder emits a fixed set of predictions each pass — one per query — and, unlike anchor detectors, it does not run a non-maximum-suppression pass to merge overlapping boxes. The list below is what the model returned directly: label, softmax confidence, and box as x, y, width, height in the image's own pixels, filtered only by your score slider.

Run detection to see the raw boxes.

Speed contrast — RT-DETR vs classic DETR

Both find the same objects; the difference is speed and cleanliness. RT-DETR (ResNet-18, ~22 MB, NMS-free) is built for real time; the original DETR (ResNet-50, ~160 MB) is the accurate-but-heavy baseline. Run both on the current image and compare the real latencies measured on your device. Loading DETR downloads ~160 MB the first time.

Why it matters

Detection you can run every frame changes what you can build. RT-DETR turns "what's in this video, right now?" into a local function call — private, offline, free per call — without the accuracy tax of the tiny anchor detectors or the latency of a full DETR.

Use cases

Basics

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

Practical

Live occupancy counter — track a chosen class over time with a running count and peak.

Wild

Full-frame webcam detector at the fastest loop your device sustains, with a still fallback.

Multi-model

RT-DETR boxes → tap one → SlimSAM returns its exact pixel mask.

How the API works

Detection is a one-liner with Transformers.js — RT-DETR uses the same object-detection pipeline as DETR:

import { pipeline } from "@huggingface/transformers";

const detect = await pipeline(
  "object-detection",
  "onnx-community/rtdetr_r18vd",
  { dtype: "q8" },        // ~22 MB, cached after first load
);

const output = await detect(imageURL, { threshold: 0.5, percentage: false });
// → [{ label: "cat", score: 0.97, box: { xmin, ymin, xmax, ymax } }, …]
//   NMS-free: the boxes are already de-duplicated — no suppression pass needed.
//   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 webcam loop grabs a frame, detects it, and only schedules the next after the last finishes, so it never piles up work or blocks the page.

References