CoolFace
Modelpublic

Yonatanhaile2026/tigrinya-trocrhandwritten

sourceHugging Facemitupdated 5mo agoView on Hugging Face
0likes16downloads
Model Card

TrOCR-Handwritten for Tigrinya OCR

![Model on HF](https://huggingface.co/Yonatanhaile2026/tigrinya-trocr-handwritten) ![License: MIT](https://opensource.org/licenses/MIT) ![Language: Tigrinya]() ![Script: Ge'ez]() ![Base: TrOCR-base-handwritten](https://huggingface.co/microsoft/trocr-base-handwritten)

Tigrinya TrOCR — Handwritten Variant

Adapting TrOCR for Printed Tigrinya Text Recognition: Word-Aware Loss Weighting for Cross-Script Transfer Learning

A fine-tuned TrOCR model for printed Tigrinya line-level text recognition. This is the handwritten pre-training variant, fine-tuned from microsoft/trocr-base-handwritten using vocabulary extension and Word-Aware Loss Weighting to resolve word-boundary failures caused by BPE space-marker conventions.


Model Details

FieldValue
Model nameYonatanhaile2026/tigrinya-trocr-handwritten
Base modelmicrosoft/trocr-base-handwritten
TaskTigrinya OCR (image-to-text)
LanguageTigrinya (ti)
ScriptGe'ez
Model typeVisionEncoderDecoderModel
VocabularyExtended from 50,265 → 50,495 tokens (230 Ge'ez characters added)
Training dataGLOCR Tigrinya News text-line images (synthetic)

Performance

Evaluated on a held-out test set of 5,000 synthetic Tigrinya text-line images.

MetricValue
Character Error Rate (CER)0.38%
Word Error Rate (WER)1.15%
Exact Match Accuracy96.86%

Bootstrap 95% Confidence Intervals (1,000 iterations, TrOCR-Printed)

MetricPoint Estimate95% CI
CER0.20%[0.17%, 0.24%]
WER0.76%[0.64%, 0.90%]
Accuracy97.44%[97.02%, 97.84%]
Bootstrap intervals were computed on the TrOCR-Printed variant; see the printed model card for details.

Comparison (same dataset and split)

ModelCERWERAccuracy
TrOCR-Handwritten (fine-tuned)0.38%1.15%96.86%
TrOCR-Printed (fine-tuned)0.22%0.87%97.20%
CRNN-CTC Baseline0.12%0.57%98.20%

Training Details

HyperparameterValue
OptimizerAdamW
Learning rate4e-5
LR schedulerLinear decay (no warmup)
Epochs10
Per-device batch size2
Gradient accumulation steps4
Effective batch size8
Mixed precisionFP16
Boundary loss weight2.0
Random seed42
Training duration~2h 40m
HardwareNVIDIA RTX 5060 Laptop (8 GB GDDR7)

How to Use

python
from transformers import VisionEncoderDecoderModel, TrOCRProcessor
from PIL import Image

processor = TrOCRProcessor.from_pretrained("Yonatanhaile2026/tigrinya-trocrhandwritten")
model = VisionEncoderDecoderModel.from_pretrained("Yonatanhaile2026/tigrinya-trocrhandwritten")

Load your text-line image
image = Image.open("your_tigrinya_text_line.png").convert("RGB")

pixel_values = processor(images=image, return_tensors="pt").pixel_values
generated_ids = model.generate(pixel_values, num_beams=5, max_length=128)
prediction = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(prediction)

Intended Use

Suitable for:

  • —Tigrinya OCR research on synthetic or clean text-line images
  • —Baseline comparison against printed-specific and CTC-based OCR models
  • —Research on cross-script transfer learning and BPE tokenizer adaptation

Not suitable for:

  • —Production OCR without validation on real scanned or handwritten documents
  • —Scenarios where the printed variant would be preferable
  • —Documents with heavy degradation, low resolution, or non-text noise

Limitations

  • —Trained and evaluated exclusively on synthetic printed data from a single domain (newspaper text lines)
  • —Performance on real-world scanned or genuinely handwritten Tigrinya documents is not validated
  • —Underperforms the printed TrOCR variant on this synthetic printed corpus
  • —Results reflect a single training run on one hardware configuration

Related Resources


Citation

If you use this model, please cite the associated paper and repository:

bibtex
@misc{medhanie2026adaptingtrocrprintedtigrinya,
      title={Adapting TrOCR for Printed Tigrinya Text Recognition: Word-Aware Loss Weighting for Cross-Script Transfer Learning}, 
      author={Yonatan Haile Medhanie and Yuanhua Ni},
      year={2026},
      eprint={2604.20813},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2604.20813}, 
}

License

MIT