Downloads · 30 days
11
34% of all-time downloads
yasalma/tatar-ocr-tesseract
tatar-ocr-tesseract is a image-to-text model from yasalma. Use it when you need a caption or text from an image. The card lists the license as apache-2.0.
A Tesseract 5 LSTM model that reads printed Tatar in Cyrillic, including the six Tatar-specific letters ә ө ү җ ң һ. Trained for digitizing Tatar books and periodicals.
Downloads · 30 days
11
34% of all-time downloads
All-time downloads
32
Public
Repo size
24.3 MB
Likes
0
Public
Click a slice to open those files.
.traineddata12.1 MB · 100%
From the Hugging Face model README
A Tesseract 5 LSTM model that reads printed Tatar in Cyrillic, including the six Tatar-specific letters ә ө ү җ ң һ. Trained for digitizing Tatar books and periodicals.
⚠️ The official tesseract -l tat does not read Cyrillic Tatar. It is a Latin-script model and produces
garbage on Cyrillic text. It does not fit Jaꞑalif (Latin Tatar of 1928–1940) either, since it lacks ə ƣ ꞑ ɵ ь;
for Jaꞑalif use tat_janalif. This model (tat_cyrl)
is fine-tuned from the Russian (rus) model.
External benchmark — yasalma/tatar-ocr-benchmark
(251 real document pages, region-level, micro-averaged CER):
| Category | CER | WER |
|---|---|---|
| books | 1.73 % | 5.8 % |
| legal | 1.29 % | 4.7 % |
| periodicals | 2.09 % | 7.4 % |
| misc* (web/graphics/forms)† | 12.9 % | 20.1 % |
| Overall | 1.95 % | 6.5 % |
misc is a catch-all of non-prose pages — web/news link lists, certificates & posters,
tables/forms — typically full of Latin URLs and decorative fonts; see Intended use & limitations below.
Internal held-out set of 225 real book lines (v1 model) (books not in training; GT = the publishers' digital text layer):
| input | CER | WER |
|---|---|---|
| clean print | 0.73 % | 5.7 % |
| scan-degraded | 3.10 % | 13.7 % |
On real library scans the output is clean, fluent Tatar with correct ә ө ү җ ң һ. See BENCHMARK.md for details, caveats, and a head-to-head
against PP-OCRv5 (cyrillic) and Marker/Surya.
# put tat_cyrl.traineddata in a tessdata directory
export TESSDATA_PREFIX=/path/to/dir/containing/tat_cyrl.traineddata
tesseract page.png stdout -l tat_cyrl --psm 3 # full page
tesseract line.png stdout -l tat_cyrl --psm 7 # single line
Python:
import pytesseract
from PIL import Image
text = pytesseract.image_to_string(Image.open("page.png"), lang="tat_cyrl", config="--psm 3")
Requires Tesseract ≥ 5.0 (LSTM engine). 300 DPI input is recommended for scans.
Three-stage fine-tuning from the Apache-2.0 rus (Russian) tessdata_best model, which provides a
strong Cyrillic foundation; we extend the character set with the six Tatar letters and adapt to
Tatar typography and real-scan noise.
Stage A — synthetic warm-up (tat_cyrl_a)
gen_synth.py: render corpus text as line images in 20 Tatar-capable fonts (each verified via
the font cmap to actually encode ә ө ү җ ң һ — not just render tofu), with light augmentation
(blur, ±1.3° rotation, background/contrast jitter). 16 000 line/ground-truth pairs.fine_tune.sh: tesstrain fine-tune rus → tat_cyrl_a (char-set extension via
--continue_from/--old_traineddata). Converges to ~0.5 % CER on the synthetic set.Stage B — real typography + scan robustness (tat_cyrl)
data/real_lines/): 2 550 real line-image + ground-truth pairs extracted
from born-digital Tatar PDFs via their text-layer line coordinates (PyMuPDF), cleaned of soft
hyphens — real publisher fonts with perfect labels, the same typography as real scans.build_train_data.py: build a 12 650-line mix = real lines × (1 clean + 2 scan-degraded) +
5 000 scan-degraded synthetic lines. Degradation models real scans: blur, Gaussian noise, JPEG
artifacts, grey aged-paper background, ±1.6° skew, and ink erosion/dilation.fine_tune2.sh: continued fine-tune tat_cyrl_a → tat_cyrl on the mix (15 k iter, LR 5e-4).This lifted scan-degraded accuracy (char-similarity 0.83 → 0.92) with no regression on clean print.
Stage C — real library scans (v2)
tat_cyrl → tat_cyrl v2 on 25 000 pseudo-labelled lines from real library scans
(each clean + 1 scan-degraded) + 8 000 synthetic lines (20 k iter, LR 5e-4).Use for: printed modern Tatar (Cyrillic) — books, literary periodicals, legal documents, single-column prose.
Weaker on: heavily decorated/illustrated magazine layouts, multi-column poetry, very degraded or skewed scans, and historical Arabic-script or Jaꞑalif (Latin) Tatar (different scripts — out of scope). A per-page confidence threshold screens these out easily.
Graphic / non-prose layouts and embedded Latin are mangled — this is a Cyrillic-only,
prose-oriented model. It is not meant for the grab-bag of "everything that isn't a printed
page", and on the benchmark this is the entire reason the misc bucket scores ~13 % CER while
books / periodicals / legal stay ≤2.1 %. That bucket is a catch-all of, for example:
For document / book / periodical OCR none of this applies; for such graphic or web/social content, run a layout-aware detector first and strip or post-process the Latin / URL tokens separately.
Apache-2.0. Tesseract is Apache-2.0; this model is fine-tuned from the Apache-2.0 rus
tessdata_best model; the training/eval/OCR scripts in this repo are released under Apache-2.0.
@misc{tat_cyrl_2026,
author = {Ilshat Saetov},
title = {tat_cyrl: a Tesseract OCR model for Cyrillic Tatar},
year = {2026},
note = {Fine-tuned from Tesseract rus; synthetic + real book lines with scan augmentation},
url = {https://huggingface.co/yasalma/tatar-ocr-tesseract}
}