A Handwritten Text Recognition (HTR) model for Church Slavonic manuscripts, based on the CNN + BiLSTM + CTC architecture introduced in Puigcerver (2017) and used as the backbone of PyLaia and Transkribus.
This is a clean-room PyTorch reimplementation of that published architecture (PyLaia-inspired). It does not use the PyLaia Python package and is not loadable by it — training and inference run via plain PyTorch (see Usage below).
symbols.txt)| Metric | Value |
|---|---|
| Validation CER | 2.89% |
| Training epochs | 59 |
| Training lines | 309,959 |
| Training pages | 2,643 |
| Validation lines | 20,679 |
| Validation pages | 205 |
Trained on Church Slavonic handwriting images transcribed and exported from Transkribus (see the corresponding Transkribus model page). The dataset covers Old Cyrillic script styles (uncial and semi-uncial), primarily East Slavic with South Slavic material included.
Source manuscripts:
Our CRNN-CTC model was trained on the full collection: 309,959 training lines (2,643 pages) and 20,679 validation lines (205 pages), exported from Transkribus.
The Transkribus model was trained by Elena Renje as part of the QuantiSlav project and curated by Achim Rabus (Slavic Department, University of Freiburg).
pip install torch torchvision pillow
Download best_model.pt, symbols.txt, and model_config.json from this repository,
then use the inference script from polyscriptor:
from inference_pylaia_native import PyLaiaInference
from PIL import Image
# Load model
model = PyLaiaInference(
checkpoint_path="best_model.pt",
syms_path="symbols.txt"
)
# Transcribe a line image
image = Image.open("line_image.jpg")
text = model.transcribe(image)
print(text)
Note: Input should be a single text line image, not a full page. Preprocessing (grayscale conversion, height normalization, aspect ratio preservation) is handled automatically by
inference_pylaia_native.py.
For full-page inference with automatic line segmentation, use batch_processing.py:
python batch_processing.py \
--engine crnn-ctc \
--model-path best_model.pt \
--input-folder images/ \
--output-folder output/
polyscriptor also ships graphical interfaces that handle full-page processing without requiring pre-segmented line images:
Interactive single-page GUI — loads raw page images, performs automatic line segmentation, and can export results as PAGE XML:
python transcription_gui_plugin.py
Batch processing GUI — processes entire folders; auto-detects existing PAGE XML files (e.g. from Transkribus) and uses them for segmentation when available:
python polyscriptor_batch_gui.py
If you use this model in your research, please cite the architecture paper and this model:
@article{puigcerver2017multidimensional,
title = {Are Multidimensional Recurrent Layers Really Necessary for Handwritten Text Recognition?},
author = {Puigcerver, Joan},
journal = {Proceedings of the 14th IAPR International Conference on Document Analysis and Recognition (ICDAR)},
year = {2017},
url = {https://www.jpuigcerver.net/pubs/jpuigcerver_icdar2017.pdf}
}
@misc{rabus2026polyscriptor,
title = {Polyscriptor: Multi-Engine HTR Training \& Comparison Tool},
author = {Rabus, Achim},
year = {2026},
url = {https://github.com/achimrabus/polyscriptor}
}
7 commits
A Handwritten Text Recognition (HTR) model for Church Slavonic manuscripts, based on the CNN + BiLSTM + CTC architecture introduced in Puigcerver (2017) and used as the backbone of PyLaia and Transkribus.
This is a clean-room PyTorch reimplementation of that published architecture (PyLaia-inspired). It does not use the PyLaia Python package and is not loadable by it — training and inference run via plain PyTorch (see Usage below).
symbols.txt)| Metric | Value |
|---|---|
| Validation CER | 2.89% |
| Training epochs | 59 |
| Training lines | 309,959 |
| Training pages | 2,643 |
| Validation lines | 20,679 |
| Validation pages | 205 |
Trained on Church Slavonic handwriting images transcribed and exported from Transkribus (see the corresponding Transkribus model page). The dataset covers Old Cyrillic script styles (uncial and semi-uncial), primarily East Slavic with South Slavic material included.
Source manuscripts:
Our CRNN-CTC model was trained on the full collection: 309,959 training lines (2,643 pages) and 20,679 validation lines (205 pages), exported from Transkribus.
The Transkribus model was trained by Elena Renje as part of the QuantiSlav project and curated by Achim Rabus (Slavic Department, University of Freiburg).
pip install torch torchvision pillow
Download best_model.pt, symbols.txt, and model_config.json from this repository,
then use the inference script from polyscriptor:
from inference_pylaia_native import PyLaiaInference
from PIL import Image
# Load model
model = PyLaiaInference(
checkpoint_path="best_model.pt",
syms_path="symbols.txt"
)
# Transcribe a line image
image = Image.open("line_image.jpg")
text = model.transcribe(image)
print(text)
Note: Input should be a single text line image, not a full page. Preprocessing (grayscale conversion, height normalization, aspect ratio preservation) is handled automatically by
inference_pylaia_native.py.
For full-page inference with automatic line segmentation, use batch_processing.py:
python batch_processing.py \
--engine crnn-ctc \
--model-path best_model.pt \
--input-folder images/ \
--output-folder output/
polyscriptor also ships graphical interfaces that handle full-page processing without requiring pre-segmented line images:
Interactive single-page GUI — loads raw page images, performs automatic line segmentation, and can export results as PAGE XML:
python transcription_gui_plugin.py
Batch processing GUI — processes entire folders; auto-detects existing PAGE XML files (e.g. from Transkribus) and uses them for segmentation when available:
python polyscriptor_batch_gui.py
If you use this model in your research, please cite the architecture paper and this model:
@article{puigcerver2017multidimensional,
title = {Are Multidimensional Recurrent Layers Really Necessary for Handwritten Text Recognition?},
author = {Puigcerver, Joan},
journal = {Proceedings of the 14th IAPR International Conference on Document Analysis and Recognition (ICDAR)},
year = {2017},
url = {https://www.jpuigcerver.net/pubs/jpuigcerver_icdar2017.pdf}
}
@misc{rabus2026polyscriptor,
title = {Polyscriptor: Multi-Engine HTR Training \& Comparison Tool},
author = {Rabus, Achim},
year = {2026},
url = {https://github.com/achimrabus/polyscriptor}
}
7 commits