Open weights
OpenThai 2.0 OCR Text
An open Thai and English OCR model small enough to run on a CPU.
- Parameters1.02million
- LicenceApache-2.0
- Printed Thai, 12 sets87.8score
- One CPU worker0.39s a page
Download the weightsUse it as an API
Open weights from iApp Technology on Hugging Face: a free download.
What it does
- Reads printed Thai and EnglishReturns the page's text in reading order, with a box and a confidence for every line. It does not write tables or Markdown; for those, use OpenThai 2.0 OCR Markdown.
- Runs on a CPU0.39 seconds per dense A4 page, one page at a time. A worker takes 0.5 CPU-seconds a page and about 450 MB of memory, so 8 Xeon cores read about 950 pages a minute. No GPU.
- Small1.02 million parameters in two files of 1.8 MB and 2.4 MB: a text-line detector and a Thai line recognizer.
- Handles real pagesTurns sideways and upside-down pages by how their lines read, straightens tilted scans, reads two- and three-column pages column by column, keeps tables and budget pages in row order, and reads light text on dark backgrounds. It passed all 22 conditions of its robustness suite.
- Ready to fine-tuneThe recognizer's weights are included for further training.
Measured
Every engine read the same pages and was scored the same way: character accuracy, 100 × (1 − character error rate), higher is better, after markup is stripped from both sides, with reading order counted. The average covers 12 printed sets; handwriting is shown apart.
| This model | OpenThai 2.0 OCR Markdown | Typhoon OCR V2 2B | |
|---|---|---|---|
| Average, 12 printed sets | 87.8 | 90.3 | 89.6 |
| Court judgments | 97.0 | 96.2 | 96.2 |
| Royal Gazette | 96.3 | 98.0 | 94.6 |
| Budget documents, verified | 99.5 | 98.2 | 97.3 |
| Old books | 77.1 | 79.7 | 77.2 |
| ThaiOCRBench pages | 82.0 | 90.6 | 87.3 |
| Handwriting | 10.3 | 78.9 | 76.7 |
| Seconds a page | 0.39 on a CPU | 2.97 on an H100 ‡ | 16.72 on an H100 † |
In short: the most accurate of the 15 engines tested on court judgments, 2.5 points below the best average, which OpenThai 2.0 OCR Markdown sets on a GPU, and a CPU is all it needs. The GPU models read tables, photographs and handwriting better. Court scans other than the 150 tested documents are in its training data.
Speed is one page at a time. This model read 24 printed pages from the sets above; ‡ 24 court-judgment pages, full A4 pages of dense text; † the 65 Thai document table pages, served with --enforce-eager, which it needs on the vLLM version used. The full table of 15 engines, the 12 sets and the speed method are in the model card.
Run it
hf download iapp/OpenThai2.0-OCR-Text --local-dir OpenThai2.0-OCR-Text
pip install openvino opencv-python-headless pyclipper numpy
cd OpenThai2.0-OCR-Text
from runtime.line_engine import LineOCR
ocr = LineOCR(".", threads=1) # det.onnx, rec.onnx, rec_dict.txt, config.json
r = ocr.read("page.png") # a path, bytes, a BGR array or a PIL image
print(r["text"]) # lines in reading order, columns one after another
r["lines"] # [{"text", "confidence", "row", "box"}], boxes in the input image's coordinates
For throughput, run one worker process per core with threads=1; threads in one process stop scaling at about two cores. ONNX Runtime works in place of OpenVINO.
Prefer a hosted service? The OpenThai 2.0 OCR Text API is built on this model: 0.049 IC a page for text, and 0.15 IC a page for layout JSON or a Word, PowerPoint, Excel or searchable PDF file.
Limits
- Printed text only. Handwriting and scene text read poorly; for those, use a vision-language model such as OpenThai 2.0 OCR Markdown.
- Decorative display fonts: short labels in heavily stylised fonts can be misread.
- Stamps and seals come out as text, since they are text on the page.
- The quoted CPU speed needs AMX (Intel Sapphire Rapids or later), where it runs in bfloat16; other CPUs run it in float32, more slowly.
Training
The recognizer was fine-tuned on 410,270 real text lines: 261,877 lines from Administrative Court scans, labelled with the court's own text; 41,101 lines from the Thai parliament's budget PDFs, kept only where the text layer and the recognizer agree; and 107,292 lines from Wikisource old books. Synthetic Thai and English lines were rendered from 85 open-licence fonts. No personal-data sets were used, and every benchmark document was left out.
Licence
Apache-2.0. The detector is PaddlePaddle's PP-OCRv6-tiny as shipped, and the recognizer was fine-tuned from PP-OCRv6-tiny's with a new Thai output layer; both are Apache-2.0, and the notices are in the repository.
Built by iApp Technology. Trained on NVIDIA H100 GPUs provided by Siam AI Corporation.