zero-shot-object-detection Β· vision-language Β· WASM Β· ~176 MB
A normal detector only knows the classes it was trained on β YOLOv10 boxes 80 fixed COCO
categories and nothing else. YOLO-World detects anything you can name.
Type your own class list β forklift, traffic cone, swan β
and a CLIP text encoder turns those words into vectors that steer a fast YOLOv8 head. No fixed
vocabulary, no retraining, all on your device. It is far quicker than the phrase-grounding
Grounding DINO, so it is the open-vocab detector you can actually
run on a live camera.
| Detector | Instemic/yolo-world-onnx Β· yolov8s-worldv2.onnx (dynamic txt_feats) |
|---|---|
| Text encoder | Xenova/clip-vit-base-patch32 β CLIP ViT-B/32 text tower, 512-dim (Transformers.js) |
| Task | zero-shot-object-detection β open-vocabulary (you supply the classes) |
| Runtime | onnxruntime-web 1.21 for the detector (no yolo-world class in transformers.js) + transformers.js 3.7.5 for CLIP text |
| How it works | CLIP text-embeds your class names β txt_feats [1,N,512] β the YOLO graph returns per-class boxes. Vocabulary is re-encoded at runtime. |
| Output tensor | [1, 4+N, 8400] β 4 box regressors + N class probabilities per anchor; sigmoid baked in, then per-class NMS |
| Quantization | Detector fp32 ONNX (48.8 MB) Β· CLIP text fp16 (127 MB) |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~176 MB total, cached after first load |
| License | Detector AGPL-3.0 (Ultralytics YOLOv8-World) Β· CLIP MIT β weights loaded from the canonical HF repos, unmodified |
| Web APIs | WebAssembly, Web Workers, OffscreenCanvas, Canvas β all Baseline widely available |
Edit the class list (these words are the whole vocabulary), pick or drop an image, and hit Detect. The classes are re-encoded only when you change them; the score slider filters the cached boxes live without re-running the model.
This is what "open-vocabulary" actually means. Your class words go through a CLIP text encoder
into 512-dim vectors; the detector treats those vectors as the class list, so its output tensor
grows a channel per word you typed β [1, 4+N, 8400] for N classes. Every surviving
box below is a real anchor from that tensor: the class it matched (the argmax over your N words),
its probability, and the box in the image's own pixels. Change a word and the whole class space
shifts β no retraining.
| # | class | score | x | y | w | h |
|---|
Fixed-class detectors force a choice you make once, at training time. Open-vocab detection moves that choice to runtime: the same tiny model detects "shopping cart" today and "fire extinguisher" tomorrow, just by changing a string. And unlike Grounding DINO β which grounds a whole caption and takes seconds per image β YOLO-World runs a single fast YOLO head, so it is practical on a live camera on-device.
Type a class list, detect, and feel open-vocab first-hand β swap a word, watch the boxes change.
Custom-class inventory counter β tally whatever objects you name from a photo, on-device.
Rare-class hunt β detect objects no COCO model knows, and A/B two phrasings of the same thing.
YOLO-World finds it β crop β a ViT classifier names it more finely.
Two on-device models compose. CLIP text-embeds your class names; the YOLO graph takes those embeddings as a dynamic input and returns per-class boxes:
import { AutoTokenizer, CLIPTextModelWithProjection } from "@huggingface/transformers";
import * as ort from "onnxruntime-web";
// 1) class names β L2-normalized CLIP ViT-B/32 text embeddings [N, 512]
const tok = await AutoTokenizer.from_pretrained("Xenova/clip-vit-base-patch32");
const clip = await CLIPTextModelWithProjection.from_pretrained("Xenova/clip-vit-base-patch32", { dtype: "fp16" });
const { text_embeds } = await clip(tok(["forklift", "pallet", "hard hat"], { padding: true }));
// 2) image + txt_feats β per-class boxes (48.8 MB YOLOv8-World-v2 ONNX)
const out = (await session.run({ images, txt_feats })).output0; // [1, 4+N, 8400]
// channels 0-3 = box cx,cy,w,h; channels 4..4+N = class probabilities (sigmoid baked in) β NMS
Both models run inside a Web Worker (CLIP text encode + letterbox + session.run +
decode + NMS), off the main thread. The class embeddings are cached, so dragging the score slider
or re-detecting the same classes never re-encodes text; the detector weights are fetched through
Cache Storage, so a returning visit auto-initialises with no re-download.