image-to-text (OCR) ยท vision ยท WASM ยท 21.5 MB
PaddleOCR v5 Mobile packs a complete, production two-stage optical character recognition pipeline into 21.5 MB of Apache-2.0 ONNX weights. Stage 1 (DBNet) locates oriented text lines anywhere on the page; Stage 2 straightens each crop and runs a CTC recognizer over an 18,383-character dictionary covering Latin scripts, Simplified & Traditional Chinese, Japanese Kana/Kanji, digits, and punctuation. Everything runs locally on your device via ONNX Runtime Web โ no receipt, invoice, or document ever leaves your browser.
| Detector |
PaddlePaddle/PP-OCRv5_mobile_det_onnx
(inference.onnx, 4.83 MB) โ DBNet oriented text-line detector
|
|---|---|
| Recognizer |
PaddlePaddle/PP-OCRv5_mobile_rec_onnx
(inference.onnx, 16.53 MB + inference.yml, 0.15 MB, 18,383 chars)
|
| Task | image-to-text (two-stage scene & document OCR: DBNet detect โ deskew crop โ CTC recognize) |
| Runtime | ONNX Runtime Web (WASM EP, off-thread Web Worker โ transformers.js has no PaddleOCR class) |
| Detector I/O | [1, 3, H, W] BGR ImageNet-normalised (H, W multiples of 32, max side 960) โ [1, 1, H, W] text probability map |
| Recognizer I/O | [1, 3, 48, W] BGR (v/255 โ 0.5) / 0.5 deskewed crop โ [1, T, 18385] CTC probabilities (blank=0, 18,383 chars, space=18384) |
| Quantization | fp32 ONNX |
| Backend | WebAssembly (WASM โ runs on desktop & mobile without requiring WebGPU) |
| Download | 21.5 MB total (4.83 MB det + 16.53 MB rec + 0.15 MB dictionary), cached in Cache Storage |
| License | Apache-2.0 (PaddlePaddle) |
| Web APIs | WebAssembly, Web Workers, OffscreenCanvas, Canvas 2D, Cache Storage โ all Baseline widely available |
Pick one of the procedural sample documents (generated live on canvas โ zero external images) or drop your own image, then run two-stage OCR locally.
โ lines recognized
100% local inference in a Web Worker โ your image, crops, and extracted text never leave the tab.
Inspect both stages of the pipeline directly: the DBNet probability heatmap (where Stage 1 predicts text pixels before polygon unclipping), the exact det vs rec latency split, and the per-character CTC probabilities emitted by Stage 2 across the 18,383-token dictionary.
Stage 1 DBNet det: โ Stage 2 CTC rec: โ Vocab: 18,383 chars
Select any line in the list above to inspect every non-blank CTC symbol and its softmax probability.
Most browser OCR setups either ship a single-line recognizer (requiring manual cropping) or download hundreds of megabytes of vision-language weights. PP-OCRv5 Mobile gives web apps a 21.5 MB end-to-end multilingual OCR engine that runs in milliseconds on CPU WebAssembly:
Multilingual text detection & recognition โ tune thresholds and inspect oriented boxes, text lines, and confidence scores.
Private receipt & document extractor โ auto-highlight dates, totals, emails, and URLs, and copy plain text or structured JSON.
Live type-to-canvas & whiteboard stress test โ compose or sketch rotated, blurred, noisy, multilingual text and watch OCR read it live.
Visual OCR โ 201-language ID: extract text from signs with PP-OCRv5 Mobile, then classify its language locally with mBERT.
Both models run via onnxruntime-web inside a dedicated Web Worker. Stage 1
detects oriented polygons; Stage 2 deskews each box to height 48 and runs greedy CTC decoding
using the 18,383-character dictionary from inference.yml:
import * as ort from "onnxruntime-web";
const detSess = await ort.InferenceSession.create(detBytes, { executionProviders: ["wasm"] });
const recSess = await ort.InferenceSession.create(recBytes, { executionProviders: ["wasm"] });
// Stage 1: DBNet detection โ [1, 3, H, W] BGR ImageNet-normalised -> [1, 1, H, W] probability map
const detOut = await detSess.run({ x: new ort.Tensor("float32", detInput, [1, 3, H, W]) });
const boxes = decodeDB(detOut.fetch_name_0.data, W, H, { detThresh: 0.3, boxThresh: 0.55 });
// Stage 2: Deskew each box to [1, 3, 48, cropW] BGR -> [1, T, 18385] CTC softmax probabilities
for (const box of boxes) {
const recOut = await recSess.run({ x: new ort.Tensor("float32", cropTo48(img, box), [1, 3, 48, cropW]) });
const { text, recScore, chars } = decodeCTC(recOut.fetch_name_0.data, T, 18385, charset);
}