Typolith HSBM v2.2 (hsbm_v2)
Compact 16.2 MB 64px RGB ONNX OCR/HTR model specialized for Гістарычны слоўнік беларускай мовы (HSBM / ГСБМ) and archival East Slavic historical dictionaries mixing modern Belarusian scholarly apparatus, Old Belarusian / Church Slavonic headwords and citations (including titlos and superscripts), Polish-Latin excerpts, letter-spaced text, and all-caps headings.
Built for local, zero-cloud execution inside Typolith (Typolith-Layout v2 is bundled directly in the Typolith package).
Model Summary
| Property | Value |
|---|---|
| Architecture | 64px RGB hybrid ConvNeXt + SVTR + Conformer (CTC, stride=2) |
| Format | ONNX (hsbm_v2.onnx + hsbm_v2.typolith-model.json) |
| Total Size | 16.2 MB (16,975,641 bytes ONNX + 2,346 bytes manifest) |
| Input Spec | 64 px height RGB (mean=0.5, std=0.5, pad_x=16, max_width=2048) |
| Typolith Script Profile | belarusian-hist |
| Recommended Polygon Top Margin | raise_top_px = 36 (300 dpi dense dictionary columns) |
Evaluation (Zero-Leakage Blind Split)
Evaluated on 6 held-out control pages of Гістарычны слоўнік беларускай мовы (vols. 1–2; 261 lines, 13,217 characters, zero page overlap with training or validation splits), using bundled Typolith-Layout v2 + hsbm_v2.onnx:
| Metric / Setup | Measured Result |
|---|---|
| Overall Blind CER (CPU FP32) | 0.55% (0.45% base letters without diacritics) |
| Overall Blind CER (Apple CoreML) | 0.56% (0.46% base letters) |
| Exact Lines | 79.7% (208 / 261 lines 100% character-exact) |
Dictionary Pages (001_0080–002_0180) |
0.44% – 0.64% CER |
Preface (001_0003) |
0.53% CER |
| End-to-End Speed (Apple M2 CoreML pipelined) | ~0.85 s / page (Layout + OCR + save; first run warms CoreML cache) |
End-to-End Speed (Pure CPU FP32 / Static INT8) |
~4–5 s / page (default FP32 CPU estimate) · ~1.80 s / page (measured with Static INT8 via typolith quantize-onnx) |
At ~0.85 s/page (Apple Silicon CoreML) or ~1.80 s/page (Static INT8 CPU), a full 300–350 page HSBM issue processes in ~4–11 minutes on a standard laptop with zero GPU server required (default FP32 on pure CPU without CoreML takes ~20–30 minutes/issue).
Scope note: This checkpoint was trained and blind-evaluated on 300 dpi scans of HSBM vols. 1–2. Accuracy on later volumes with noticeably different typesetting or 1-bit scans can be adapted quickly using Typolith's built-in
Train Bundleexport (typolith export --format train-bundle).
Files Included
| File | Size (bytes) | SHA-256 |
|---|---|---|
hsbm_v2.onnx |
16,975,641 |
b08075fb5e12347e032f2380dbfc9877e55442b8f7f04688a5c9aa8200137b26 |
hsbm_v2.typolith-model.json |
2,346 |
c46851f930488797edf7c30b518511d5ff8d8c16d22c5070c73a3af4b719b0c1 |
infer.py |
6,848 |
83714c1fe3bf5ef32aff214fb1f4ecdd7ea9c0818b9577b9fda3881dc28938cc |
Quick Start with Typolith
git clone https://github.com/ourdictionary/typolith.git
cd typolith
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[all]"
# Open Typolith, click Models -> Install on "hsbm-v2" (or copy the downloaded files into ./models/)
typolith serve ./hsbm-book --open
Or run headless batch recognition + archival export via CLI:
typolith init ./hsbm-book --name "HSBM Vol. 1" --profile belarusian-hist
typolith import ./hsbm-book ./scans/
typolith segment ./hsbm-book --raise-top-px 36
typolith ocr ./hsbm-book --model ./models/hsbm_v2.onnx
typolith export ./hsbm-book --format tei-lex0 --out ./exports/hsbm_vol1.lex0.tei.xml
Standalone Python Usage (Without Typolith)
If you already have cropped line images and want to run hsbm_v2.onnx directly in your own Python pipeline without installing Typolith:
pip install onnxruntime pillow numpy
python infer.py line1.png line2.png
Or import the helpers from infer.py:
from infer import load_meta, load_session, recognize_line
meta = load_meta("hsbm_v2.typolith-model.json")
session = load_session("hsbm_v2.onnx")
text, confidence = recognize_line("line1.png", session, meta)
(This standalone script expects pre-cropped text line images and performs greedy CTC decoding. For automatic page layout analysis, reading-order detection, dictionary style tags, and PAGE XML / ALTO 4.4 / TEI P5 / TEI Lex-0 export, use Typolith.)
License
Pre-trained weights and manifest (hsbm_v2.onnx, hsbm_v2.typolith-model.json) are dual-licensed:
- Open-Weights Non-Commercial (
CC BY-NC-SA 4.0): Free to download, run locally, evaluate, and adapt for academic/philological research, personal and educational projects, and public non-commercial libraries, archives, museums, and universities. - Recognized Outputs Belong Unconditionally to the User: All recognized texts, XML (
PAGE XML,ALTO 4.4,TEI P5,TEI Lex-0), PDFs, DOCX, HTML, and Markdown exports produced with these weights belong unconditionally to the user or hosting institution, with noNCorShareAlikerestrictions on your digitized editions. - Commercial License & Institutional Waivers: A commercial license is required for for-profit digitization bureaus, SaaS/cloud APIs, proprietary integration, or distilling competing commercial models. Public libraries and grant-funded academic projects (e.g., DFG, Horizon Europe) may request a written institutional license waiver via https://github.com/ourdictionary/typolith (see
MODELS_LICENSE.md).
Copyright (c) 2026 Aleksandr Masenkov.