← All models

object-detection · vision · WASM · ~30 MB

YOLOS-Tiny — fast object detection with a plain Vision Transformer

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.

At a glance

ModelXenova/yolos-tiny
Task / pipelineobject-detection
ArchitectureViT-Tiny encoder + 100 detection tokens — a pure transformer, no convolutional backbone
Classes80 COCO categories (person, car, dog, chair, bottle…)
Quantizationq8 (8-bit) ONNX
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~30 MB, cached after first load
LicenseApache-2.0 (HUST Vision Lab)
Web APIsWebAssembly, Web Workers, Canvas, FileReader — all Baseline widely available

Run it

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.

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.40

See inside

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.

Run detection to see the raw boxes.

YOLOS-Tiny vs DETR — why you'd pick the small one

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.

YOLOS-Tiny
DETR (ResNet-50)
Download (q8)
~30 MB
~160 MB
Backbone
ViT-Tiny (no CNN)
ResNet-50 + transformer
COCO box AP
28.7
42.0
This device — latency
run to measure
—

Loads DETR (~160 MB) once and detects the same photo, so the latency figures above are apples-to-apples on your hardware.

Why it matters

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.

Use cases

Basics

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

Practical

On-device inventory counter — pick a class and count it across a batch of photos.

Wild

Live webcam object counter — small enough to run per frame, on-device.

Multi-model

YOLOS boxes → tap one → SlimSAM returns its exact pixel mask.

How the API works

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.

References