Image-to-Text
Transformers
Sinhala
trocr
ocr
sinhala
printed-text
vision-encoder-decoder

TrOCR Sinhala Printed Lines

Phase 0 research repository. No fine-tuned weights or final evaluation results have been released yet.

This project investigates whether fine-tuning Ransaka/TrOCR-Sinhala on synthetic Sinhala text-line images improves printed, line-level Sinhala OCR performance on real documents.

Project status

Workstream Status
Research scope Locked in PROTOCOL.md
Dataset license Confirmed MIT
Intermediate checkpoint license MIT, confirmed
Training Not started
Evaluation Not started
Model weights Not published

The complete model and training-data chain is MIT-licensed: microsoft/trocr-base-printedRansaka/TrOCR-SinhalaRansaka/sinhala_synthetic_ocr-large → this project's derived weights. Ransaka confirmed the intermediate checkpoint's MIT license on 2026-07-29 and declared it in the repository metadata. The permanent confirmation record is linked in ATTRIBUTION_AND_LICENSING.md.

Research question

Does synthetic-data fine-tuning of TrOCR improve printed, line-level Sinhala OCR on real documents?

Scope

In scope

  • Printed Sinhala text
  • Line-level text recognition
  • Character Error Rate (CER)
  • Word Error Rate (WER)
  • Comparisons with the unmodified checkpoint and Tesseract 5.5
  • Optional Surya comparison when its applicable terms are confirmed
  • Period-stratified analysis where document-year metadata is available

Out of scope

  • Handwriting
  • Full-page layout detection or reading order
  • Production or high-stakes deployment
  • Broad Sinhala-English code mixing
  • Claims of parity with page-level commercial or large vision-language systems

Data

Training and validation

Ransaka/sinhala_synthetic_ocr-large

  • 6,969 synthetic Sinhala image-text pairs
  • One published train split
  • Five reported font families
  • Dataset DOI: 10.57967/hf/1809
  • Repository LICENSE: MIT
  • Fixed project split: 90% train and 10% validation using seed 42

The exact generated indices and dataset revision must be written to the experiment manifest before training.

Real-document evaluation

avishadilhara/sinhala-ocr-lk-acts-1010

  • 1,010 page images from Sri Lankan legislative acts
  • Published splits: train 707, test 202, evaluation 101
  • License: CC BY 4.0
  • Paper: arXiv:2606.29378

TrOCR is a line-recognition model. The page dataset must therefore be converted into a documented, deterministic line-level benchmark before direct evaluation. Page-level benchmark figures are contextual references and must not be presented as directly comparable line-level results.

Pre-registered experiment

The hypotheses, fixed splits, seeds, metrics, normalization, hyperparameters, decision rules, and reporting requirements are defined in PROTOCOL.md. Material deviations must be documented before results are interpreted.

Planned baselines

System Role Primary comparison
Ransaka/TrOCR-Sinhala Starting checkpoint Measures improvement from additional fine-tuning
Tesseract 5.5 Permissive classical baseline CER and WER on the same line images
Surya OCR Optional research baseline CER and WER on the same evaluation unit

Published page-level results are contextual targets only:

System CER WER Evaluation unit
Tesseract v5 10.69% Not reported Real pages
Surya OCR 8.84% 26.64% Real pages
Google Document AI 2.06% Not reported Real pages
Fine-tuned LightOnOCR-2-1B 1.05% 5.63% Real pages

These figures come from a June 2026 preprint and are not direct line-level acceptance thresholds.

Planned training configuration

Parameter Pre-registered value
Optimizer AdamW
Learning rate 4e-5
Epochs 10
Effective batch size 8
Precision FP16 when supported
Seed 42
Evaluation beams 4
Runs 3 independent runs

The machine-readable configuration is in configs/phase0.yaml.

Evaluation and reporting

CER is the primary metric and WER is secondary. Report:

  • Results for every seed, plus mean and standard deviation
  • Exact dataset revisions and split-index checksum
  • Raw and normalized metrics
  • 95% paired bootstrap confidence intervals for model differences
  • Error examples grouped by degradation type
  • Results by document period where supported
  • Runtime and hardware details

Final results belong in results/metrics.json and the table below. Do not add zero-value placeholders to Hugging Face model-index metadata because they can be mistaken for real results.

System Dataset/slice CER mean ± SD WER mean ± SD Status
Starting checkpoint Real Sinhala line benchmark TBD TBD Not run
Fine-tuned model Real Sinhala line benchmark TBD TBD Not run
Tesseract 5.5 Real Sinhala line benchmark TBD TBD Not run
Surya OCR Real Sinhala line benchmark TBD TBD Optional

Intended use

The eventual model is intended for research and prototyping involving printed Sinhala text lines, including OCR experiments, document digitization research, and accessibility prototypes. Human review is required for consequential use.

Limitations

  • Synthetic training data may not represent real scanning noise, skew, bleed-through, compression, damaged print, or historical typography.
  • Training fonts cover only a limited part of Sinhala typography.
  • Accuracy may degrade on older documents, handwriting, mixed-language text, unusual symbols, curved lines, and full pages.
  • Line segmentation quality can dominate end-to-end page performance.
  • Results from legislative acts may not generalize to receipts, books, forms, signs, or contemporary digital screenshots.

Bias and responsible use

The training domain may overrepresent clean, computer-generated Sinhala and underrepresent historical fonts and real capture conditions. Evaluate new domains before use. Do not use unreviewed OCR output as authoritative evidence in legal, medical, financial, identity, or public-administration decisions.

Public legislative documents can contain names. Preserve source attribution, minimize unnecessary retention, and review extracted text before redistribution.

Planned inference

The final release will support the standard Transformers interface:

from PIL import Image
from transformers import TrOCRProcessor, VisionEncoderDecoderModel

repo_id = "kaan84/sinhala-print-trocr"
processor = TrOCRProcessor.from_pretrained(repo_id)
model = VisionEncoderDecoderModel.from_pretrained(repo_id)

image = Image.open("sinhala-line.png").convert("RGB")
pixel_values = processor(images=image, return_tensors="pt").pixel_values
generated_ids = model.generate(pixel_values, num_beams=4)
text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(text)
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

Model tree for kaan84/sinhala-print-trocr

Finetuned
(3)
this model

Datasets used to train kaan84/sinhala-print-trocr

Paper for kaan84/sinhala-print-trocr