Arjuna-OCR [Kn&En] v1.2.1
This repo documents v1.2.1 (layout v12). The current release is v1.3.3 (layout v15) and ships from anandkaman/arjuna-ocr-kn-en-inference — the benchmarks below were measured on v1.2.1 and have not been re-run for v1.3.x.
Try it: live demo (CPU, images or the first 2 pages of a PDF).
Layout-aware OCR for printed Kannada and English documents — registration and revenue records, gazettes and circulars, books, newspapers, textbooks, born-digital PDFs and scans.
- 98.8 % word accuracy on the held-out private document set (Kannada 98.0 %, English 99.5 %); 96.3 % on the public Mozhi Kannada benchmark, 93.7 % on MILE, 97.2 % on English PDF text; 96.3 % on 1890s dictionary / maths-textbook / 1900s print pages (v1.0: 84.9 %)
- 12.8 pages/s on one RTX 5060 Ti with TensorRT at ~50 % GPU load and 3.3 GB VRAM (120 ms per page in single-page mode); CUDA and CPU fallbacks
- Outperforms Surya OCR 1 on Kannada/English documents — 0.991 vs 0.929 word F1 on clean private-document pages, 0.872 vs 0.751 on unseen public MILE pages, at ~18× the throughput (see below)
- v1.2.1: the text detector no longer boxes Kannada conjuncts as separate words — fragment marks drop 60 % on registration records, 99 % on 1900s print and 81 % on unseen Kannada books, and page CER improves to 3.1 %
- v1.2: a layout model trained on Kannada/English documents (tables found 20/20 vs 15/20 on the frozen pages, ID-card panels and handwriting as their own block types), and a recognizer pass on dates, long numbers, alphanumeric codes and ₹ amounts — see
docs/RELEASE_NOTES.md - Reading order, paragraphs, titles, tables (rows / cells), seals, figures, ID panels and handwriting regions; output as JSON, Markdown, plain text, hOCR, ALTO or TSV
- Every line carries a confidence, the confidence of its weakest character and review flags — nothing is silently dropped or rewritten
What is inside
| stage | model | role |
|---|---|---|
| Layout | Arjuna layout v12 — DocLayout-YOLO fine-tuned on Kannada/English document pages (v1.2) | blocks: text, title, table, figure, seal, ID-card panel, handwriting, header, footer. Next: more document layouts — forms, invoices, registers, letters, slides. |
| Text detection | Arjuna det v1.2.1 — PP-OCRv6 det fine-tuned for Kannada conjuncts | line boxes; below-baseline vattus stay with their line instead of becoming separate "words" |
| Text recognition | SVTRv2-B + Kannada/English language pack | 221-class CTC head: ASCII, Kannada block, document and maths symbols. Next: more language packs, and more dual-language pairs built the same way as Kn+En. |
| Assembler | rule-free | row clustering, ruled-grid tables, serialisation to the output formats |
All three models ship as ONNX and run on ONNX Runtime. TensorRT is the fast path (fp16 engines, validated engines for RTX 5060 Ti included, rebuilt automatically on other GPUs); CUDA and CPU providers work without TensorRT at lower speed. The PyTorch language pack (pytorch/kanen_pack_e5.pth) is included for training, fine-tuning and evaluation with the training code — it is not needed for inference.
Just want to run it?
pip install arjuna-ocr # models download on first use
arjuna doctor && arjuna ocr page.pdf -o out/
The ready-to-deploy package — self-configuring, with Docker images and a Hugging Face Inference Endpoints handler — lives in anandkaman/arjuna-ocr-kn-en-inference. This repository is the archive: every release, the full evaluation record and the training story.
Install (from this repository)
Python 3.10–3.12, NVIDIA GPU with a CUDA 12 driver (the CPU provider works everywhere, ~40× slower).
git clone https://huggingface.co/anandkaman/arjuna-ocr-kn-en && cd arjuna-ocr-kn-en
pip install -e . # ONNX Runtime GPU + CUDA/CPU providers
pip install -e ".[trt]" # + TensorRT 10.16 (recommended: ~13 pages/s vs ~4.6 on the CUDA provider)
pip install -e ".[server,pdf]" # optional: HTTP server, PDF input
python prepare_engines.py # once per machine: builds / validates the TensorRT engines (~4 min; instant on RTX 5060 Ti)
python check_parity.py # runs the 5 sample pages and compares with the reference output
Windows (tested on i9 / RTX 5060 Ti): same packages, set KANEN_TRT=1 — see docs/WINDOWS.md. CUDA / cuDNN / TensorRT details: docs/USAGE.md.
Quick start
No install: the demo Space runs this model on CPU (about a minute per dense page; upload images or a PDF, first 2 pages).
Command line:
arjuna-ocr --input scans/ --out-dir out/ --format json,md # file, directory, glob or PDF
arjuna-ocr --input "private documents/*.png" --out-dir out/ --format all --page-batch 8 --workers 8
arjuna-ocr --input report.pdf --out-dir out/ --format txt --provider cuda
Python:
from kanen_infer.api import KanEnOCR
ocr = KanEnOCR() # loads config, models and engines; ocr.ready() shows the provider per model
doc = ocr.page("scan.png") # one document: blocks -> lines (text, confidence, min_conf, bbox, flags), tables -> rows/cells
docs = ocr.pages(["p1.png", "p2.png"], page_batch=8)
boxes = ocr.detect(image) # detection only
texts = ocr.recognize(line_crops) # recognition only: [(text, confidence, min_conf), ...]
from kanen_infer.formats import to_markdown, to_text, to_hocr, to_alto, to_tsv
HTTP: python serve.py --port 8000 → POST /ocr (one image), POST /ocr/batch, GET /health.
Output
One kanen-ocr/1.0 JSON document per page: blocks[] in reading order (type, bbox) → lines[] with text, confidence, min_conf (weakest character), bbox, script and flags; tables carry rows[].cells[]; page.text is the plain reading-order text; model records the model hashes and pipeline version. Flags route lines to human review: low_conf (< 0.90), check (0.90–0.98), weak_char (min_conf < 0.5), script_mix, oversize, in_seal, in_figure. Calibration: lines with confidence ≥ 0.99 are 97.7 % exact (44 % of lines). Markdown, text, hOCR, ALTO and TSV are serialisations of the same document — format details in docs/USAGE.md.
Accuracy
Held-out validation set (in-house, frozen before model selection, labels verified line by line)
| set | lang | lines | CER | word accuracy | line exact |
|---|---|---|---|---|---|
| Private documents (40 pages) | kn + en | 1,324 | 0.17 | 98.8 % (kn 98.0 / en 99.5) | 95.4 % |
| Modern Kannada books & journals | kn | 150 | 0.52 | 95.6 % | 86.0 % |
| Archive scans 1894–2023 | kn | 518 | 1.14 | 92.8 % | 77.6 % |
| 1890s dictionary, Kannada-medium maths, 1900s prints | kn + en | 618 | 0.47 | 96.3 % | 89.8 % |
| English PDF text | en | 1,500 | 0.49 | 97.2 % | 88.3 % |
| Digit-dense lines: dates, amounts, IDs (new in v1.2) | kn + en | 615 | 0.40 | 97.7 % | 94.5 % |
End-to-end on the 40 private-document pages: word precision / recall / F1 0.965 / 0.970 / 0.967, detection F1 0.952, corpus page CER 3.1 % (median 1.4 %), reading-order τ 0.956, table regions found 20/20 (v1.1: 15/20), orientation (0/90/180/270) recovered on every page with printed text. Full report: docs/QC_REPORT.md. How the data and the evaluation sets were built: docs/DATA_AND_EVALUATION.md.
Public benchmarks (docs/PUBLIC_BENCHMARKS.md, with per-benchmark error analysis)
| benchmark | lang | n | word accuracy | note |
|---|---|---|---|---|
| Mozhi test (IIIT-Hyderabad printed Kannada) | kn | 9,838 | 96.3 % | v1.1: 96.0 %, v1.0: 96.6 % |
| MILE (IISc Kannada document pages, old print) | kn | 6,051 | 93.7 % | v1.1: 93.6 % |
| SROIE 2019 receipts | en | 19,366 | 83.6 % case-insensitive | 57.1 % under the raw upper-cased labels; ~92 % after normalising benchmark-specific label conventions (analysis in the report) |
| FUNSD word crops (fax-quality forms) | en | 8,707 | 81.5 % | v1.1: 81.0 %; errors concentrate at ≤ 11 px x-height — still the English gap |
None of these test splits were used for training or model selection.
Compared with Surya OCR 1
Same 17 unseen pages through both systems on the same RTX 5060 Ti, scored against verified word-level ground truth with the same scorer.

| pages | Surya OCR 1 | Arjuna-OCR v1.1 | Arjuna-OCR v1.2.1 |
|---|---|---|---|
| 10 clean private-document pages (frozen test), word F1 | 0.929 | 0.987 | 0.991 |
| dense fee-table page | 0.685 | 0.812 | 0.880 |
| stamped, low-contrast page | 0.776 | 0.931 | 0.889 (page CER 8.0 % → 1.9 %) |
| 5 public MILE (IISc) book pages, never seen by either model | 0.751 | 0.847 | 0.872 |
| throughput on one RTX 5060 Ti | 0.37–0.76 pages/s, 4.2 GB | 13.6 pages/s (v1.1) | 12.8 pages/s, 3.3 GB |
Surya's inline markup was stripped before scoring so only characters count; Surya wins two of the five MILE pages individually and collapses on three, Arjuna stays between 0.78 and 0.90 on all of them. v1.2 recognises the same words as v1.1 on the fee-table and stamped pages (identical word hits); the lower page scores come from the scorer's handling of lines that the new layout joins across skipped handwriting regions. Method and per-page scores: docs/COMPARISON_SURYA1.md. Surya OCR covers 90+ languages — this comparison is only about printed Kannada/English documents.
Performance (RTX 5060 Ti, 150-DPI pages)
| configuration | pages/s |
|---|---|
| TensorRT fp16, all three models, page batch 8 | 12.8 on the 40 frozen pages, warm (v1.2: 13.3, v1.1: 13.6) — measured at ~50 % GPU utilisation and 3.3 GB VRAM on a 4-core host: the CPU side is the limit, the GPU has headroom |
| TensorRT, single-page latency mode | 8.3 (120 ms / page) |
| CUDA provider, no TensorRT | 4.6 |
| Outputs are identical across page batch sizes for printed text; only handwriting fragments can differ. |
Known limitations (v1.2.1)
- Very small or fax-quality English text (≤ 11 px x-height) and dot-matrix / thermal receipts lose accuracy.
- Historical Kannada (old typefaces, letterpress) is strong but below modern print; residual errors are archaic glyph confusions and spacing conventions of letter-spaced type. Kannada digits are the weakest class.
- Dense multi-column tables (10+ columns) and unruled form boxes are emitted as text lines without cell structure; ruled fee tables and small tables are reconstructed reliably.
- The layout model is a first version trained on 174 pages of the target document families (registration and revenue records, forms, gazettes, assembly records, books, newspapers, textbooks, ID cards). On other families (invoices, letters with letterheads, ledgers, slides, photographed pages) expect blocks to be typed less reliably; text lines are unaffected because detection and recognition do not depend on the layout model. Blocks spanning the whole page are handled by a second reduced-scale pass. A broader, DETR-based layout model is the planned v1.3 item.
- Handwriting, stamps, seals, bleed-through produce low-confidence output rather than nothing — use the flags for review gating.
- Line splitting on very old print is much reduced but not gone (v1.2.1 fine-tuned the detector for Kannada conjuncts: fragment marks −60 % on records, −99 % on 1900s print, −81 % on unseen books). What remains are pieces at the very start or end of a line that fall outside the line box; on letter-spaced or letterpress faces the detector can still split a line at wide gaps or cut off a detached vattu, and the recognizer then reads fragments without context. Only the recognizer is trained for Kannada in this release. The verified line boxes shipped with the training data are ready for detector fine-tuning — you can do it, or ask the author to (see Contact & sponsorship).
- Other Indic scripts: ~90 % of foreign-script lines now produce no text; the rest come out as flagged garbage. Remaining out-of-charset symbols (superscripts, ∅ ⊂ ≈ →) map to the nearest known glyph.
Versions
- v1.2.1 (this release,
main, tagv1.2.1): the text detector was taught, using its own output as the label, to stop marking Kannada conjuncts as separate words. End-to-end word F1 0.9636 → 0.9672, page CER 3.67 % → 3.11 %, detection F1 0.934 → 0.952; ID-card and table short fields verified unchanged (538/553 words vs 537/553). Recognizer and layout identical to v1.2.docs/DETECTOR_V121.md. - v1.2 (tag
v1.2): recognizer E5 (dates, long numbers, codes, ₹ amounts; +2,266 real digit-dense lines), first Kannada-aware layout model (9 classes incl.id_panel/handwriting), assembler column-gap and nested-block rules, layout engine self-test against reference boxes.docs/RELEASE_NOTES.md. - v1.1 (tag
v1.1): recognizer ONNX md5 in every output'smodel, charset 221 classes. Adds kn4 (newspapers, magazines, textbooks, assembly records, RTC) and kn5 (1890s dictionary, Kannada-medium maths, 1900s prints) training slices, maths symbols, italic-serif and fax-degradation synthesis, other-script rejection, and theweak_char/script_mix/oversizereview flags. Equal to v1.0 on private documents, +11 points on old dictionary/maths pages, +0.5 on archive scans; −0.5 on Mozhi and −0.8 on FUNSD word crops. - v1.0 (tag
v1.0): training run E4, 213 classes — the first production release. - Same output schema across versions (
kanen-ocr/1.0);charset_md5differs between v1.0 and v1.1/v1.2;model.layoutisarjuna-layout-v12from v1.2 (pp-doclayoutv3before). Block typeraw_typevalues changed with the new layout model.
Contact & sponsorship
Arjuna-OCR is built and maintained by one person. For datasets, custom OCR / translation / document models, or to sponsor the next versions (more Indic scripts, table structure, a compact vision-language OCR model), open a discussion on this repo or write to kamananand98@gmail.com.
Data & licences
Licences. Package code, recognizer and text detector: Apache-2.0 (top-level LICENSE). The v1.2 layout model models/layout/kanen_layout_v12.onnx is AGPL-3.0 (models/layout/NOTICE.md, LICENSE-AGPL-3.0.txt): it was fine-tuned from the Apache-2.0 DocLayout-YOLO DocStructBench weights with the AGPL-3.0 doclayout_yolo toolkit (Ultralytics YOLO lineage), and we follow that lineage rather than argue about it. No toolkit code ships here (inference is ONNX Runtime); if AGPL does not suit your deployment, run with layout.mode: never or plug in another layout model. Base models: PP-OCRv6 det (PaddleOCR, Apache-2.0), SVTRv2 (OpenOCR, Apache-2.0); v1.0/v1.1 used PP-DocLayoutV3 (Apache-2.0). The language pack was trained on synthetic renders (OFL / GPL-font-exception / Apache fonts), the Mozhi Kannada dataset, public English PDFs and SROIE, public-domain Kannada scans from archive.org, and private registered-private-document scans (verified labels; not included — they contain personal data). No test page appears in training. Code, pack and engines: Apache License 2.0.
Citation
@software{arjuna_ocr_2026, title = {Arjuna-OCR [Kn&En]: layout-aware Kannada + English document OCR}, author = {anandkaman}, year = {2026}, version = {1.2}, url = {https://huggingface.co/anandkaman/arjuna-ocr-kn-en}}