zero-shot-object-detection Β· vision + language Β· WASM Β· ~155 MB
OWLViT was the first vision transformer to do open-vocabulary detection: you type the objects you
want as free text β a cat, a remote control, a potted plant β
and it embeds each phrase and each image region into a shared CLIP space, then boxes the regions
that match. No fixed class list, no retraining, all on your device. It's the model
OWLv2 was built to improve on.
| Model | Xenova/owlvit-base-patch32 |
|---|---|
| Task / pipeline | zero-shot-object-detection |
| Architecture | OWLViT β CLIP ViT-B/32 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 (model_quantized.onnx) |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~155 MB, cached after first load |
| License | Apache-2.0 (Google OWLViT) |
| Web APIs | WebAssembly, Web Workers, Canvas, FileReader β all Baseline widely available |
OWLViT runs on the CPU here, so the first detect after loading takes a couple of seconds β honest progress is shown, and it is genuinely running on your device.
Both take the same input (an image + your text queries) and return the same shape (boxes + labels + scores). What differs:
| OWLViT (this page) | OWLv2 | |
|---|---|---|
| Released | 2022 β the original | 2023 β the successor |
| Training | Detection + CLIP contrastive pre-training | Adds self-training on ~2B pseudo-box web images (OWL-ST) |
| Backbone here | ViT-B/32 (patch 32) | ViT-B/16 ensemble (patch 16) |
| Typical accuracy | Strong, the baseline | Higher recall on rare / long-tail phrases |
| Download | ~155 MB (q8) | ~400 MB (q8) |
| Speed here | Lighter / faster per run | Heavier, generally more accurate |
The honest summary: OWLViT is smaller and quicker and still genuinely open-vocabulary; OWLv2 usually finds more, especially for unusual descriptions. Try the same queries on both pages and compare.
Pick or drop an image, type the objects you want as comma-separated text, and hit Detect. OWLViT runs once at a low floor; the score slider then filters the boxes live without re-running the model.
OWLViT turns every text query into a vector and every candidate image region into a vector in the same CLIP 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. OWLViT removed that step β the class list is an input, typed at runtime, in the browser, for free. It's the model that made "detect anything you can name" practical, and it's small enough to ship to a phone.
Type your own labels, hit detect, and watch OWLViT box exactly what you described.
Custom inventory / inspection β count "a bottle" or "a helmet" with no training.
Ask for weird things β "something dangerous", "the odd one out" β and see what v1 matches.
OWLViT 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/owlvit-base-patch32",
); // downloads + caches ~155 MB once
const queries = ["a cat", "a remote control", "a potted plant"];
const output = await detect(imageURL, queries, { threshold: 0.1, percentage: false });
// β [{ label: "a cat", score: 0.58, 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.