zero-shot-object-detection Β· vision + language Β· WASM Β· ~400 MB
Ordinary detectors only know the classes they were trained on. OWLv2 is open-vocabulary: you type
the objects you want as free text β a cat, a remote control,
a person wearing red β and it embeds each phrase and each image region into a shared
space, then boxes the regions that match. New label set, no retraining, all on your device.
| Model | Xenova/owlv2-base-patch16-ensemble |
|---|---|
| Task / pipeline | zero-shot-object-detection |
| Architecture | OWLv2 β ViT-B/16 image encoder + text encoder, per-region query matching |
| Vocabulary | Open β any text query you provide at runtime (no fixed class list) |
| Quantization | q8 (8-bit) ONNX |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~400 MB, cached after first load |
| License | Apache-2.0 (Google OWLv2) |
| Web APIs | WebAssembly, Web Workers, Canvas, FileReader β all Baseline widely available |
OWLv2 is a big model and runs on the CPU here, so the first detect after loading can take a few seconds β honest progress is shown, and it is genuinely running on your device.
Pick or drop an image, type the objects you want as comma-separated text, and hit Detect. OWLv2 runs once at a low floor; the score slider then filters the boxes live without re-running the model.
OWLv2 turns every text query into a vector and every candidate image region into a vector in the same space, then scores each region against each query by similarity β that score is what the threshold filters. Below is the real output: a per-query summary (how many regions matched and the best score), then the raw boxes with their matched query and pixel coordinates. This is what the model returned β no post-processing beyond the score filter.
| query | matches | best score |
|---|
| # | query | score | x | y | w | h |
|---|
Every fixed-class detector forces the same question: "is your object one of the 80 it knows?" If not, you collect a dataset and fine-tune. OWLv2 removes that step β the class list is an input, typed at runtime, in the browser, for free. That turns bespoke detection from a training project into a text box.
Type your own labels, hit detect, and watch OWLv2 box exactly what you described.
Custom inventory / inspection β count "a forklift" or "a helmet" with no training.
Ask for weird things β "something dangerous", "the odd one out" β and see what matches.
OWLv2 finds a region β SlimSAM returns its exact pixel mask.
Open-vocabulary detection is a one-liner with Transformers.js β the query list is just an argument:
import { pipeline } from "@huggingface/transformers";
const detect = await pipeline(
"zero-shot-object-detection",
"Xenova/owlv2-base-patch16-ensemble",
); // downloads + caches ~400 MB once
const queries = ["a cat", "a remote control", "a person wearing red"];
const output = await detect(imageURL, queries, { threshold: 0.1, percentage: false });
// β [{ label: "a cat", score: 0.29, box: { xmin, ymin, xmax, ymax } }, β¦]
// label is the matched query; percentage:false gives pixel coordinates
This page runs the model once at a low floor threshold 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. Changing the query text re-runs the model (new text embeddings). The canvas is drawn at the image's natural resolution and scaled by CSS, so boxes stay pixel-accurate.