VietOCR, tested on 30 Vietnamese book scans
88.8%
of words right, VietOCR on Tesseract's lines
VietOCR wins on words, ties on marks
| Way | Marks right | Words right |
|---|---|---|
| VietOCR vgg_transformer | 93.9% | 88.8% |
| VietOCR vgg_seq2seq | 93.9% | 88.7% |
| Tesseract -l vie | 93.6% | 85.3% |
| Our Actor, language vie | 91.8% | 83.5% |
Marks: tone marks, the vowel marks of ă â ê ô ơ ư, and đ. Words: syllables in order, every mark right.
On Nov 9, Tesseract with tessdata_best vie got 94.1% of marks and 86.2% of words on the same pages.
- Tesseract -l vie
- 6.6 s
- a page
- VietOCR vgg_seq2seq
- 13.3 s
- a page
- VietOCR vgg_transformer
- 21.6 s
- a page
Times include the Tesseract pass and are rough: the Mac was busy. On Nov 9, Tesseract took 1.8 s a page.
Both miss the hook tone in old type
In this 1925 book, the hook tone sits on the circumflex like a small 2. On all 30 pages, a hook read as a grave is the top mark error for both.
| Printed | Tesseract | VietOCR |
|---|---|---|
| thể | thề | thể |
| Hể | Hề | Hề |
| để | đề | đề |
| nổi | nồi | nồi |
- Tesseract
- 531
- of 848 hook syllables right
- VietOCR vgg_transformer
- 591
- of 848 right
- Both wrong
- 225
- the same syllables
VietOCR cannot write « or »
Its alphabet has neither mark. The scans hold 87 of them, and VietOCR wrote none: it put a letter or a digit there. Tesseract wrote 82 and our Actor 86.
vietocr_page.py reads a whole page
VietOCR reads one line at a time and finds no lines. vietocr_page.py asks Tesseract for the lines, cuts each line at word gaps into pieces up to about 16 line heights long, and reads each piece.
python3.12 -m venv venv
venv/bin/pip install vietocr torch torchvision "setuptools<81"
venv/bin/python vietocr_page.py page.jpg
pip install vietocralone installs no torch.- Each run fetches the model config from vocr.vn, and the first run downloads the weights.
-
Add
--model vgg_seq2seqfor less than half of VietOCR's time, with the same marks right. - It needs Tesseract 5 with vie on the PATH. We ran it on Python 3.12. vietocr_page.py is MIT, and VietOCR is Apache-2.0.
Our Actor reads Vietnamese, below Tesseract
Our Apify Actor turns scans into Markdown, and its Language input has Vietnamese. Its row in the table is the code of build 0.1.100, run on our Mac.
The free plan takes 20 pages a run, 50 a month. A scanned page costs $0.006, and pages with a text layer are free.
How I tested it
- 30 pages, 2 each from 15 books on Vietnamese Wikisource. The truth is the proofread wiki text at one pinned revision.
- The scans are 960 to 1920 px wide. They are the pages of our Tesseract Vietnamese test, fetched again, and Tesseract scored the same on all 30.
- Tesseract 5.5.4 with tessdata_fast 4.1.0 vie. VietOCR 0.3.13 on torch 2.15.0 and Python 3.12, CPU only. Our Actor's code at commit 5c8f91b0 (build 0.1.100).
- Not tested: GPUs, beam search, fine-tuning, other line finders, phone photos, handwriting, Windows and Linux.
Questions people ask
Is VietOCR better than Tesseract for Vietnamese?
A little, on these scans. It got 88.8% of words right on Tesseract's lines, against 85.3% for Tesseract -l vie. It took about 3 times as long with the default model.
Can VietOCR read a whole page?
Not by itself. It reads one cropped line of text and does not find lines. vietocr_page.py on this page uses Tesseract's line boxes for that.
Does VietOCR need a GPU?
No. We ran it on a Mac CPU with 2 threads. The default model added 15.0 seconds a page, and vgg_seq2seq added 6.7 seconds.
Can I use VietOCR in a commercial product?
The code is Apache-2.0 (setup.py and PyPI say MIT). The repo's README, LICENSE, setup.py and configs state no license for the pretrained weights (checked November 20, 2026), so ask the author before you ship them.