VieSVTR v7 โ Vietnamese + English text-line recognition
A small, fast single-pass CTC recogniser for one cropped text line (Vietnamese and English). 7.66 M parameters, input height 64 px, any width up to 1600 px. Built at the MLCV lab (UIT) to replace a VGG-Transformer VietOCR model in production.
| Input | one cropped text line, RGB, any size (resized to height 64, width rounded to a multiple of 4, 32โ1600 px) |
| Output | text + mean confidence (greedy CTC) |
| Parameters | 7.66 M (โ 31 MB fp32) |
| Charset | 229 characters (Vietnamese letters with all diacritics, Latin, digits, punctuation, space) |
| Files | config.json (model settings) ยท weights/viesvtr_v7.onnx (ONNX, opset 17, dynamic width) ยท weights/viesvtr_v7.safetensors (PyTorch) |
It does not find text on a page. Pair it with a text-line detector, then send each line crop.
Try it in your browser: ngocthua830/VieSVTR-demo โ the ONNX model runs
locally with ONNX Runtime Web, so your image is not uploaded. app.py is a Gradio version of the same demo for running on your
own machine (pip install gradio onnxruntime pillow numpy && python3 app.py).
Quick start
pip install onnxruntime numpy pillow opencv-python-headless
python3 predict.py examples/vi_date.png
# examples/vi_date.png Ngร y 25 thรกng 10 nฤm 2026 0.993
from viesvtr.infer import OnnxRecognizer # or TorchRecognizer("weights/viesvtr_v7.safetensors")
rec = OnnxRecognizer("weights/viesvtr_v7.onnx")
text, conf = rec("line.jpg") # path, PIL image or RGB numpy array
Without cloning the repo (needs pip install huggingface_hub; the package viesvtr/ must be importable):
from viesvtr.infer import from_pretrained
rec = from_pretrained("ngocthua830/viesvtr") # backend="torch" for the safetensors weights
text, conf = rec("line.jpg")
Architecture
3ร64รW โ conv stem (stride 4) โ 3 residual conv stages (vertical stride only) โ 4รW/4
โ learned height collapse โ 3 self-attention blocks (local conv positional encoding) โ CTC head (230 classes)
Design choices: height 64 (a Vietnamese vowel can carry a modifier and a tone mark stacked above it; at 32 px those marks fall below one feature row, and many long lines have fewer CTC steps than characters), one forward pass (no autoregressive decoding, so latency does not grow with text length), and auxiliary base-letter / diacritic CTC heads during training only (dropped at inference).
Results on public test sets
Full test splits, ONNX Runtime on CPU, text NFC-normalised and whitespace-collapsed. CER = character error rate.
eval/eval_lines.py reproduces every number in this table.
| Test set | Lines | VieSVTR v7 CER โ | VieSVTR exact โ | VietOCR baseline CER โ | VietOCR exact โ |
|---|---|---|---|---|---|
| VinText (Vietnamese scene text) | 8,421 | 6.13% | 85.2% | 15.16% | 68.9% |
| CORD (receipts) | 1,040 | 1.59% | 87.6% | 26.91% | 49.4% |
| MC-OCR (Vietnamese receipts) | 521 | 6.62% | 66.4% | 12.51% | 42.6% |
| HierText (English) โ ๏ธ | 37,883 | 6.89% | 66.0% | โ | โ |
| TextOCR (English scene) โ ๏ธ | 13,483 | 17.26% | 65.1% | โ | โ |
Baseline: the public VietOCR vgg_transformer checkpoint (37.6 M parameters, autoregressive), as deployed in our lab,
scored with the same script on the same lines.
Contamination note. The training mix includes Union14M, which shares upstream images with HierText and TextOCR, so those two rows are optimistic and should not be read as clean English benchmarks. VinText, CORD and MC-OCR test splits were not used for training.
Speed (same GPU, Quadro RTX 8000, batch 1): about 12 ms per line vs about 98 ms for the VGG-Transformer baseline; about 264 MiB of GPU memory.
Training data
About 3.1 million text lines: public datasets (Union14M, HierText, TextOCR, VinText, CORD, MC-OCR and others), rendered
synthetic Vietnamese text, and private in-house data. The private data is not released. No training image is
distributed with this model; the images in examples/ are synthetic and were rendered for this card.
Limitations
- One line at a time; rotated, curved or multi-line crops are out of scope.
- Weaker on English receipts and on unusual scanned documents than on the domains above.
- Greedy decoding, no language model; the confidence is a mean of per-step probabilities, not a calibrated probability.
License
CC BY-NC 4.0 (non-commercial). Some training datasets allow non-commercial research use only, so commercial use is
not permitted. See LICENSE.
Citation
@misc{viesvtr2026,
title = {VieSVTR: a single-pass CTC text-line recogniser for Vietnamese and English},
author = {MLCV Lab, University of Information Technology (VNU-HCM)},
year = {2026},
note = {Model release v7}
}
- Downloads last month
- 28