← All models

object-detection (text) Β· vision Β· WASM Β· ~2.4 MB

Scene text detection β€” where is the text?

A text detector doesn't read words β€” it finds where they are. This PaddleOCR DBNet model turns a photo into a per-pixel "is this text?" probability map, then decodes that map into oriented boxes around every text region β€” a receipt's line items, a shop sign, angled poster type. It runs entirely on your device via ONNX Runtime Web; the image and the boxes never leave the tab. Detection locates text; reading it is a separate step (see the multi-model demo).

At a glance

Modelbreezedeus/cnstd-ppocr-en_PP-OCRv3_det β€” PaddleOCR PP-OCRv3 detection (DBNet)
Taskobject-detection (text-region detection) β€” run via raw ONNX Runtime Web (see note below)
Runtimeonnxruntime-web 1.21 (transformers.js has no DBNet text-detection class)
Input[1, 3, H, W] NCHW β€” the image resized so H,W are multiples of 32, ImageNet-normalised
Output[1, 1, H, W] β€” a per-pixel text-probability map; decoded (threshold β†’ connected components β†’ min-area box) into region polygons
Quantizationfp32 ONNX
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~2.4 MB, cached after first load
LicenseApache-2.0 (ONNX export) Β· PaddleOCR (Apache-2.0)
Web APIsWebAssembly, Web Workers, OffscreenCanvas, Canvas β€” all Baseline widely available

Run it

Pick a sample (or drop your own image), then detect. The model returns oriented boxes around every text region β€” it does not read the words.

CafΓ© storefront sign with several lines of text Grocery receipt with itemised lines Book page paragraph Poster with rotated, angled text Street scene with mixed signage
Drop / choose your own image

Everything runs on your device β€” the image, the probability map, and the boxes never leave the tab. The samples are generated for this demo (no real people or brands).

See inside

The model's real output isn't boxes β€” it's a probability map: one number per pixel for "how likely is this text?". Brighter = more confident. All the boxes above are decoded from this map: threshold it, group connected bright pixels into regions, then fit a minimum-area (possibly rotated) rectangle to each. That's the whole DB decode, made visible.

Detect an image to see its probability map.

Why it matters

Detection is the first stage of every OCR and document pipeline β€” and doing it on-device means a sensitive document (a receipt, an ID, a form) never has to be uploaded to find its text. Once you know where text is, you can act on regions without reading a word:

This detector locates text regions; it does not recognise characters, languages, or reading order β€” pair it with an OCR model for that.

Use cases

Basics

One image in, oriented boxes out β€” see the model find every text region and count them.

Practical

On-device redaction β€” detect every text region in a document and black it out before sharing.

Wild

Rotated, angled, dense text β€” watch the oriented boxes tilt to hug slanted poster type.

Multi-model

Detect β†’ read: locate each text region, then run TrOCR on the crops to actually read them.

How the API works

transformers.js has no DBNet text-detection class, so we run the ONNX graph directly with ONNX Runtime Web. The model gives a probability map; the "DB decode" turns it into boxes:

import * as ort from "onnxruntime-web";

const session = await ort.InferenceSession.create(dbnetBytes, { executionProviders: ["wasm"] });

// image β†’ [1,3,H,W] NCHW (H,W multiples of 32), ImageNet-normalised
const input = new ort.Tensor("float32", normalize(image), [1, 3, H, W]);
const { [session.outputNames[0]]: prob } = await session.run({ [session.inputNames[0]]: input });

// DB decode: threshold the probability map β†’ connected components β†’ min-area box per region
const regions = decode(prob.data, W, H, /*thresh*/ 0.3, /*boxThresh*/ 0.5);

Inference and the whole decode run in a Web Worker so the UI never blocks, and the 2.4 MB model is fetched through Cache Storage, so a returning visit auto-initialises with no re-download.

References