object-detection · vision · WASM · ~30 MB
YOLOS ("You Only Look at One Sequence") strips detection back to a bare Vision Transformer: no CNN backbone, no anchors, no region proposals — just image patches plus a handful of learned "detection tokens," and out come labelled boxes. The tiny build is about a fifth the size of DETR and quick enough to run on a live camera, entirely on your device.
| Model | Xenova/yolos-tiny |
|---|---|
| Task / pipeline | object-detection |
| Architecture | ViT-Tiny encoder + 100 detection tokens — a pure transformer, no convolutional backbone |
| Classes | 80 COCO categories (person, car, dog, chair, bottle…) |
| Quantization | q8 (8-bit) ONNX |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~30 MB, cached after first load |
| License | Apache-2.0 (HUST Vision Lab) |
| Web APIs | WebAssembly, Web Workers, Canvas, FileReader — all Baseline widely available |
Pick or drop an image and hit Detect. YOLOS runs once at a low floor; the score slider then filters the boxes live without re-running the model.
YOLOS carries 100 "detection tokens" through the transformer alongside the image patches; each
token is decoded into one class (or "no object") plus a box of 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 |
|---|
Both do the same job — 80 COCO classes, boxes + scores from one forward pass. They trade differently: DETR's ResNet-50 backbone is more accurate on small/cluttered objects; YOLOS-Tiny is a fraction of the download and fast enough to run per webcam frame. Latency below is measured live on your device when you run each model.
Loads DETR (~160 MB) once and detects the same photo, so the latency figures above are apples-to-apples on your hardware.
A capable detector that downloads in a few seconds and runs per frame changes what's practical in a web page. YOLOS-Tiny turns "what's in this camera feed, right now?" into a local function call — private, offline, free per call — without shipping a 160 MB model first.
One image, labelled boxes, a threshold slider — feel ViT detection first-hand.
On-device inventory counter — pick a class and count it across a batch of photos.
Live webcam object counter — small enough to run per frame, on-device.
YOLOS boxes → tap one → SlimSAM returns its exact pixel mask.
Detection is a one-liner with Transformers.js — YOLOS uses the exact same object-detection pipeline as DETR, so swapping models is a one-line change. The boxes come back in pixel coordinates:
import { pipeline } from "@huggingface/transformers";
const detect = await pipeline(
"object-detection",
"Xenova/yolos-tiny",
); // downloads + caches ~30 MB once
const output = await detect(imageURL, { threshold: 0.4, percentage: false });
// → [{ label: "cat", score: 0.96, 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.