Downloads · 30 days
0
anandkaman/arjuna-ocr-kn-en
arjuna-ocr-kn-en is a image-to-text model from anandkaman. Use it when you need a caption or text from an image. It is set up for onnxruntime. The card lists the license as apache-2.0.
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.
Downloads · 30 days
0
Access
Public
Updated Oct 4, 2026
Repo size
839 MB
Likes
1
Public
Click a slice to open those files.
.onnx166 MB · 54%
From the Hugging Face model README
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.
docs/RELEASE_NOTES.md| 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.
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.
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.
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.
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.
| 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.
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.
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.
| 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. |
main, tag v1.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): 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): recognizer ONNX md5 in every output's model, 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 the weak_char / script_mix / oversize review 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): training run E4, 213 classes — the first production release.kanen-ocr/1.0); charset_md5 differs between v1.0 and v1.1/v1.2; model.layout is arjuna-layout-v12 from v1.2 (pp-doclayoutv3 before). Block type raw_type values changed with the new layout model.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 [email protected].
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.
@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}}