tetrak-hy-trainer
Training pipeline for an Armenian text recogniser — synthetic data generation, CTC model training, and packaging as an EasyOCR custom model.
Why
No mainstream local OCR engine reads Armenian well. EasyOCR and PaddleOCR do
not list the language at all; Tesseract ships hye traineddata of
unmeasured quality on archival material. Yet the architecture EasyOCR
already uses — CRAFT text detection feeding a compact CTC recogniser — is
proven on Armenian: a National Library of Armenia-adjacent system built on
exactly these components reported character error rates better than Google
Cloud Vision on dense newsprint.
Detection needs no training (CRAFT is script-agnostic). All the Armenian-specific work concentrates in one small trainable model, and EasyOCR has a documented custom-model mechanism to load it. This repository builds that model.
What it produces
Three files, loadable by stock EasyOCR:
| File | Contents |
|---|---|
tetrak_hy.yaml |
Character list, language list, image height, network parameters |
tetrak_hy.py |
The recognition network module (Model(num_class, **network_params)) |
tetrak_hy.pth |
Trained weights — published as GitHub Release assets, never committed |
import easyocr
reader = easyocr.Reader(
["hy"],
recog_network="tetrak_hy",
user_network_directory="path/holding/yaml/and/py",
model_storage_directory="path/holding/pth",
)
reader.readtext("scan.png")
The name is a Python module name (EasyOCR imports it), hence the underscore. The model uses a CTC head — EasyOCR's custom-model inference path is CTC-only.
Distribution happens through
tetrak-easyocr-armenian,
the installable library whose import package is the tetrak_hy network:
this trainer's output — the yaml, the weights and their provenance — lands
there as a pull request, and a weights release on that repo is what users
install. The bundle-writing here remains the tool for local spikes and for
producing that PR.
Status
Early scaffold. The pipeline stages, in order:
- Charset —
src/tetrak_hy_trainer/charset.py, the single source of truth read by both the trainer and the packaging step. ✔ (two decisions deliberately open; see the module) - Packaging — emit a valid
tetrak_hy.yamlfrom the charset. ✔ - Spike — train a deliberately tiny model and prove the EasyOCR loading contract end to end. Not started.
- Synthetic data — Armenian corpus text rendered in Armenian fonts with archival degradations. Not started.
- Training — CTC pre-training on synthetic crops, fine-tuning on human-verified real crops. Not started.
Data and font licences
Recorded as sources are adopted:
| Source | Use | Licence |
|---|---|---|
| Armenian Soviet Encyclopedia on Armenian Wikisource (13 volumes, 1974–1987) | Corpus text for synthesis; paired page scans + transcripts for fine-tuning crops and evaluation | CC BY-SA 3.0, as stated by the hosting Wikisource page |
Two disciplines attach to the encyclopedia source:
- Only proofread pages. Wikisource seeds unproofread pages with machine OCR; training on those would teach the model another engine's mistakes. Harvesting filters on ProofreadPage quality status (proofread/validated only), via the API.
- Attribution and share-alike. BY is satisfied by this table and the provenance records shipped with weights. Whether SA obligations propagate to trained weights is a genuinely unsettled question; we record the source and licence with every release so the position is auditable either way.
Further candidates: Armenian Wikisource's public-domain period texts and Armenian Wikipedia (CC BY-SA 4.0) for corpus text; the Noto Armenian family, GHEA faces and Arian AMU (all OFL) for fonts.
Licence
Apache License 2.0 — see LICENSE and NOTICE. Training code will derive in part from EasyOCR's trainer (Apache 2.0), itself derived from NAVER's deep-text-recognition-benchmark (Apache 2.0).
A deliberate exclusion: this project was informed by studying portmind/armenian-ocr (CC BY-NC 4.0), whose approach it independently reproduces from permissively-licensed parts. No code, annotations or weights from that project are included here, and contributions derived from it cannot be accepted — its non-commercial licence is incompatible with this one.
Relationship to Tetrak
This is a satellite of Tetrak, a local-first
transcription pipeline for archival material. Tetrak ships the inference
files and consumes the released weights as its easyocr-hy backend;
benchmark results against its evaluation corpus are published there.
Development
python3 -m venv .venv && source .venv/bin/activate
pip install -e '.[dev]'
pytest
ruff check src tests && ruff format --check src tests
Commits follow Conventional Commits,
enforced by the hook in .githooks/ (git config core.hooksPath .githooks
after cloning, or lefthook install). Releases and CHANGELOG.md are
generated from those commits automatically on every push to main.
See CONTRIBUTING.md for the full workflow — checks, the dependency lockfile, and what the automation expects — and SECURITY.md for how to report a vulnerability.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tetrak_hy_trainer-0.5.2.tar.gz.
File metadata
- Download URL: tetrak_hy_trainer-0.5.2.tar.gz
- Upload date:
- Size: 233.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8a24a90ed12b95dd27dd17325beca5da16aeacd8c89f0be970c275a97f3faca
|
|
| MD5 |
0d0ed4c1ff59ce1001c66363024c6a38
|
|
| BLAKE2b-256 |
979dfca50c9f605c358159deb246f506740aea6a7934777ee27ed20e02220160
|
Provenance
The following attestation bundles were made for tetrak_hy_trainer-0.5.2.tar.gz:
Publisher:
release.yml on scattercode/tetrak-hy-trainer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tetrak_hy_trainer-0.5.2.tar.gz -
Subject digest:
a8a24a90ed12b95dd27dd17325beca5da16aeacd8c89f0be970c275a97f3faca - Sigstore transparency entry: 2689927359
- Sigstore integration time:
-
Permalink:
scattercode/tetrak-hy-trainer@873061fef70df10f7344f99ca02323db0d78dc84 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/scattercode
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@873061fef70df10f7344f99ca02323db0d78dc84 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tetrak_hy_trainer-0.5.2-py3-none-any.whl.
File metadata
- Download URL: tetrak_hy_trainer-0.5.2-py3-none-any.whl
- Upload date:
- Size: 49.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0733405935f8b7903fe99bec08ef0c5f1126a64fbab6a22002e956a542ab6d8a
|
|
| MD5 |
fda00fbaf1d46c9cac3b275ec4c0a0ae
|
|
| BLAKE2b-256 |
492d6427c4b0e60ca58a40329fe55263d12eaac4b12aceda7d0f315dcc6bd7cc
|
Provenance
The following attestation bundles were made for tetrak_hy_trainer-0.5.2-py3-none-any.whl:
Publisher:
release.yml on scattercode/tetrak-hy-trainer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tetrak_hy_trainer-0.5.2-py3-none-any.whl -
Subject digest:
0733405935f8b7903fe99bec08ef0c5f1126a64fbab6a22002e956a542ab6d8a - Sigstore transparency entry: 2689927407
- Sigstore integration time:
-
Permalink:
scattercode/tetrak-hy-trainer@873061fef70df10f7344f99ca02323db0d78dc84 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/scattercode
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@873061fef70df10f7344f99ca02323db0d78dc84 -
Trigger Event:
push
-
Statement type: