object-detection Β· vision Β· WASM Β· ~10 MB
YOLO11 is Ultralytics' latest detector β more accurate than YOLOv10 at the same tiny size. But it makes the opposite design choice: where YOLOv10 trains an NMS-free head that hands back tidy, deduplicated boxes, YOLO11 keeps the classic dense head β one forward pass returns 8400 overlapping candidate boxes that you must clean up yourself with Non-Max-Suppression. Drop an image, then slide the IoU threshold and watch NMS collapse the duplicate flood in real time, entirely on your device.
| Model | webnn/yolo11n (nano) |
|---|---|
| Task | object-detection β run via raw ONNX Runtime Web (see note below) |
| Runtime | onnxruntime-web 1.21 (transformers.js has no yolo11 class) |
| Architecture | YOLO11-nano Β· C3k2 / C2PSA backbone Β· classic dense detection head (needs NMS) |
| Output tensor | [1, 84, 8400] β 8400 anchors Γ (4 box coords + 80 class scores), NOT deduplicated |
| Classes | 80 COCO categories (person, car, dog, chair, bottleβ¦) |
| Post-process | argmax the 80 class scores per anchor β threshold β Non-Max-Suppression |
| Quantization | fp32 ONNX (opset 19) |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~10 MB, cached after first load |
| License | AGPL-3.0 (Ultralytics YOLO11) β weights loaded from the canonical HF repo, unmodified |
| Web APIs | WebAssembly, Web Workers, OffscreenCanvas, Canvas β all Baseline widely available |
Pick or drop an image and hit Detect. YOLO11 runs once at a low floor; the two sliders then filter the cached candidates and re-run NMS live β no re-inference. Score decides how sure a box must be; IoU decides how aggressively NMS merges overlapping boxes.
This is the whole point of YOLO11 vs YOLOv10. YOLO11's dense head emits a fixed
[1, 84, 8400] tensor: 8400 candidate boxes, most of them near-duplicates of the same
object. First we argmax the 80 class scores at each anchor to get its best label and
confidence; then we drop everything below the score floor; then Non-Max-Suppression
walks the survivors from most to least confident, throwing away any box that overlaps an
already-kept box of the same class by more than the IoU threshold. Watch the numbers move as you drag
the sliders β every step runs on the cached candidates, no re-inference.
| # | label | score | x | y | w | h |
|---|
YOLO11 is the current default when people say "just use YOLO" β it's the accuracy sweet spot at the nano size, and it runs at ~10 MB entirely in a page. Understanding that it needs NMS (and YOLOv10 doesn't) is the difference between a detector that works and one that draws three boxes around every object. Here you can feel both halves β the raw model output and the classical clean-up β with nothing uploaded.
One image, two sliders β watch score + NMS turn 8400 raw candidates into clean boxes.
Inventory counter β tally objects by class from a photo, on-device, with a tuned NMS.
Live webcam detector β real-time boxes with a per-frame latency and FPS readout.
YOLO11 boxes β crop one β a ViT classifier names it more finely.
Because transformers.js has no yolo11 class, we run the ONNX graph directly and
hand-write the three steps a pipeline would normally own β letterbox in, decode the dense head out,
and dedupe with NMS:
import * as ort from "onnxruntime-web";
const session = await ort.InferenceSession.create(modelBytes); // ~10 MB fp32 ONNX
// preprocess: resize longest edge β 640, pad to 640Γ640, /255 β Float32 [1,3,640,640]
const { output0 } = await session.run({ images: input });
// output0.dims === [1, 84, 8400] (channel-major: value(c, a) = data[c*8400 + a])
// per anchor a: cx,cy,w,h = data[0..3][a]; classScores = data[4..83][a]
// β argmax the 80 class scores, threshold, then run Non-Max-Suppression (IoU) to dedupe
This page runs the model once at a low floor (0.05) inside a Web Worker β letterboxing on an OffscreenCanvas and decoding the head there β then caches every candidate and re-runs the client-side NMS as you drag the sliders, so both knobs are instant and never re-run inference. The ONNX weights are fetched through Cache Storage, so a returning visit auto-initialises with no re-download.