Qalam UTRNet-Large fine-tune (step 1000)
Pipeline code: https://github.com/HassanNizami/qalam-urdu-ocr
Model description
A fine-tuned UTRNet-Large line recogniser for printed Urdu (Nastaliq) newspaper text. The architecture is HRNet feature extraction, a DBiLSTM sequence model and a CTC head, 47.3M parameters. It takes a line crop (height 32, aspect ratio kept, right-padded to width 800) and outputs Urdu text.
It is one component of the Qalam Urdu OCR pipeline. A right-to-left line segmenter crops lines from the page. The recogniser decodes each line with CTC prefix beam search (alpha 0.2, beta 0.0, beam 25) and an order-6 character language model. The full pipeline is described in the repository README.
Base checkpoint
- Starting weights: the released UTRNet-Large checkpoint (Rahman, Ghosh, Arora, ICDAR 2023).
- Released as:
utrnet-ft-step1000.pt, a PyTorchstate_dictfor the UTRNet model.
Fine-tuning data
- Newspaper lines: 12,695 filtered line crops mined from newspaper pages, with transcripts. Mined labels are noisy (about 22 % by our estimate). The pool was filtered against the 829 evaluation references with a 20-character overlap test (198 lines removed as near-duplicates); page-level disjointness was not verified, so treat the 7.24 figure as measured on the benchmark but not proven contamination-free.
- Synthetic lines: rendered Urdu text lines.
- UTRSet-Real: the human-transcribed UTRSet-Real lines (CC BY-NC-SA 4.0, per the upstream README).
- Mix per batch: newspaper 0.5, synthetic 0.125, UTRSet-Real 0.375.
- Augmentation: mild blur, contrast and JPEG changes, and ±1° rotation. Every image is horizontally mirrored to match the inference preprocessing.
Training
- Optimiser: AdamW, weight decay 0.01, gradient clip 5. Learning rate 5e-5 for the head, 3e-5 for the BiLSTM and 1e-5 for the HRNet backbone. 500-step warmup, then cosine decay.
- Batch 4 with gradient accumulation 4 (effective batch 16), full precision (fp32), input width 800. Autocast was disabled after an in-place-autograd failure.
- Fine-tuned for 1000 selected steps (the 3-hour wall-clock cap would have stopped it at 1112). Checkpoint step 1000 is the one released, selected on held-out mined lines, not on the 829 evaluation blocks.
Metrics
Macro-averaged over blocks, using the project's scoring protocol.
| Evaluation | CER % | WER % | Notes |
|---|---|---|---|
| UNB 829 blocks (checkpoint, beam + char LM) | 7.24 | 25.57 (computed from the step-1000 829-block journal, JIWER-compatible normalisation) | length ratio 0.943; 1.86 s/block on a T4 |
| UNB 829 blocks (+ 3-variant layout selection) | 6.76 | 23.79 | selector thresholds chosen on this benchmark, disclosed; 4.56 s/block |
| UTRSet-Real clean lines (294 lines, beam) | 4.68 | - | greedy: 5.55 % |
Error decomposition on the 829 blocks: 5.56 points character error and 1.68 points space placement. These are analysis numbers, not a separate result.
Reference points from the UNB paper (not re-run here): TrOCR 15.9 / 42.2; Kraken 22.1 / 55.8; EasyOCR 24.6 / 80.2; UTRNet published run 30.6 / 60.2; Gemini-2.5-Pro 3.2 / 13.3.
Not SOTA; frontier VLMs are stronger.
Decoder
- CTC prefix beam search, alpha 0.2, beta 0.0, beam width 25. Tuned on 60 dev-split blocks, not the 829.
- Character language model: order 6,
charlm6.json.
Intended use
- Research on Urdu printed-text OCR and reproducible benchmarking.
- First-pass transcription and triage of newspaper scans.
- Use with human review. A person must check output before it is relied on.
Out-of-scope use
- Commercial use of any kind. The weights are CC BY-NC-SA 4.0 (non-commercial, ShareAlike) and the upstream research-only terms apply.
- Legal, evidentiary, or archival fidelity. Character and space errors are common.
- Unreviewed automated transcription of documents where errors matter.
- Handwritten text. The model is trained on printed text.
Limitations
- Space placement and character errors both remain (see metrics).
- Lines come from a heuristic segmenter; no gold line boxes are available to score it.
- Mined training labels are noisy, about 22 % by our estimate.
- 30 of 829 evaluation blocks are flagged by the diagnostic for possible dropped content. They are still scored.
- Evaluated only on newspaper blocks and clean UTRSet-Real lines.
Licence
CC BY-NC-SA 4.0 (Attribution-NonCommercial-ShareAlike), derived from UTRNet: research-only, non-commercial, ShareAlike, with attribution. The upstream LICENSE also carries an all-rights-reserved line. This repository does not relicense the weights; any redistribution of the fine-tuned checkpoint must keep the same non-commercial ShareAlike terms and attribution. See NOTICE in the repository.
Citation
@inproceedings{rahman2023utrnet,
title = {UTRNet: High-Resolution Urdu Text Recognition in Printed Documents},
author = {Rahman, Abdur and Ghosh, Arjun and Arora, Chetan},
booktitle = {Document Analysis and Recognition -- ICDAR 2023},
publisher = {Springer},
pages = {305--324},
year = {2023},
doi = {10.1007/978-3-031-41734-4_19}
}
@misc{arif2026press,
title = {From Press to Pixels: Evolving Urdu Text Recognition},
author = {Arif, Samee and Farid, Sualeha},
howpublished = {LREC 2026; arXiv:2505.13943},
year = {2026},
note = {Benchmark dataset: ULRs/Urdu-Newspaper-Benchmark}
}
Dataset used to train has-niz/qalam-urdu-ocr
Paper for has-niz/qalam-urdu-ocr
Evaluation results
- Macro CER on UNB (829 newspaper paragraphs)self-reported7.240
- Macro WER on UNB (829 newspaper paragraphs)self-reported25.570