ThaOCR layout β€” Khmer + English page layout detector (YOLO11, ONNX)

Stage 1 of 5 of the ThaOCR pipeline. Finds regions on a page image: text, title, table, stamp, logo, handwriting and more. Static input [1,3,1024,1024]; class names are stored in the ONNX names metadata. Letterbox and NMS are done by the caller.

Models

id version file size description val
layout_yolo11s_v1_12cls v1 layout/layout_v1_12cls.onnx 38.2 MB YOLO11s layout v1 (12 classes, ONNX) –
layout_yolo11s_v1_12cls_pt v1 layout/layout_v1_12cls.pt 19.2 MB YOLO11s layout v1 (12 classes, torch) –
layout_yolo11s_v2_r2_21cls v2 layout/layout_v2_r2_21cls.onnx 38.2 MB YOLO11s layout v2 round 2 (21 classes, ONNX) mAP50 0.962 / mAP50-95 0.834
layout_yolo11n_v2_21cls v2 layout/layout_v2_n_21cls.onnx 10.9 MB YOLO11n layout v2 phone-size (21 classes, ONNX, 2.6M params) mAP50 0.956 / mAP50-95 0.798
layout_yolo11n_v3_22cls (default) v3 layout/layout_v3_n_22cls.onnx 10.9 MB YOLO11n layout v3 phone-size (22 classes: + decoration, letterheads) mAP50 0.972 / mAP50-95 0.842

The default is the 10.9 MB YOLO11n (phone-size). On its own validation set it reaches precision 0.967 and recall 0.939. The 38 MB YOLO11s round-2 model scores about the same on the shared classes (mAP50 0.971 / mAP50-95 0.847 on the v3 val set) but cannot predict decoration. The v1 models are kept for comparison only. layout_v1_12cls.pt is the Ultralytics torch checkpoint of v1.

Classes

  • v3 (22): text, title, section_header, list, table, figure, caption, header, footer, page_number, footnote, formula, signature, stamp, logo, qr_code, barcode, photo, handwriting, checkbox, form_field, decoration.
  • v2 (21): the v3 list without decoration.
  • v1 (12): text, title, list, table, figure, signature, stamp, logo, qr_barcode, handwriting, header_footer, formula.

How they were trained

Ultralytics YOLO11, image size 1024, AdamW, cosine learning rate, mosaic 0.6, no horizontal flip. Trainer: training/layout/train.py.

  1. v1 β€” YOLO11s, 12 classes, trained in the earlier Khm-Dataset-Creation repo on synthetic Khmer pages, real Khmer PDF pages with heuristic labels and DocLayNet.
  2. v2 round 1 β€” YOLO11s from the v1 weights, 21-class taxonomy, 30-epoch schedule (stopped at 26 by the time budget), lr0 1e-3, batch 8. mAP50 0.964, mAP50-95 0.834.
  3. v2 round 2 (layout_v2_r2_21cls.onnx) β€” continued from round 1 on the round-2 set (32,290 train / 923 val pages), 22 epochs, lr0 5e-4, batch 8. mAP50 0.962, mAP50-95 0.834.
  4. v2 nano (layout_v2_n_21cls.onnx) β€” YOLO11n (2.6 M parameters) from the COCO-pretrained yolo11n.pt on the same round-2 set, 31 epochs, lr0 2e-3, batch 16.
  5. v3 nano (layout_v3_n_22cls.onnx, default) β€” fine-tune of v2 nano on layout_v3 (18,000 train / 1,100 val pages: 10,000 new docgen v3 pages that add the decoration class β€” ornaments, rules, letterhead decorations β€” plus 8,000 pages replayed from round 2 so older classes are not forgotten). Batch 16, lr0 6e-4, 30-epoch schedule (37 epochs run), rotation Β±2Β°, scale 0.35, mosaic closed for the last 3 epochs.

Training data (round-2 set) and licences

data type licence
docgen v2 / v3 synthetic pages (12,000 Cambodian + US/English documents: letters, memos, invoices, receipts, forms, ID cards, reports, exam sheets, newspapers; English text from Project Gutenberg, Faker identities, procedural stamps/logos/figures) synthetic generated
DocLayNet v2 (6,895 train / 647 val real pages, 11 classes + page_number, plus degraded scan/photo copies) real CDLA-Permissive 1.0
Real Khmer PDF pages (government / NGO PDF crawl, heuristic labels, 548 train / 173 val, each also degraded) real research use
SignverOD signatures, mapo80 stamp scans real crops Apache-2.0 / CC-BY-4.0
D4LA form / invoice / letter / memo subset (2,834 train; classes D4LA does not label were filled by a teacher model, training/layout/pseudo_label.py) real Apache-2.0 per ModelScope; page images are third-party IIT-CDIP documents
CommonForms (1,517 pages, checkbox boxes only) real Apache-2.0
docgen exam answer sheets (3,000 pages, phone-photo degradation) synthetic generated

The owner's private exam photos were never used for training.

Licence

The base weights come from Ultralytics YOLO11, which is licensed AGPL-3.0, so these layout models inherit AGPL-3.0. Some training data is research-use only (see the table), so check that your use fits those terms as well.

Part of ThaOCR

ThaOCR is a five-stage Khmer + English document OCR pipeline (layout, text-line detection, line recognition, font classification, page structure). Every model is plain ONNX (opset 17) and runs with onnxruntime on CPU. There is one repo per stage:

The index repo Thareah/ThaOCR-models holds the full models.json manifest for all five stages. models.layout.json in this repo lists only this stage. The file and vocab paths in both are relative to a folder into which all stage repos are downloaded together, for example hf download Thareah/ThaOCR-layout --local-dir ThaOCR. The pre/post-processing (letterbox + NMS, DB unclip, width bucketing + CTC, ...) is small numpy/OpenCV code in the ThaOCR backend (backend/app/services/stages/).

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support