AHLR-VT: A Hybrid CNN–Vision Transformer Architecture for Offline Amharic Handwritten Text-Line Recognition
# AHLR-VT: A Hybrid CNN–Vision Transformer for Offline Amharic Handwritten Text-Line Recognition
Official code for **AHLR-VT**, a hybrid CNN + ViT-Base/16 + CTC architecture for
line-level offline handwritten text recognition (HTR) in Amharic (Ge'ez script),
together with the depth-ablation family used for the parameter-scaled efficiency
comparison in the paper.
- **Paper:** AHLR-VT: A Hybrid CNN–Vision Transformer Architecture for Offline
Amharic Handwritten Text-Line Recognition
- **Dataset:** AHLD-29K on Hugging Face
— we created a new benchmark dataset, 29,947 writer-independent, line-level handwritten Amharic text-line images
from 180 writers, split 80:10:10 (train/validation/test).
- **Author:** Misiker Kassahun Zewde
---
## Table of contents
1. Repository structure
2. Prerequisites
3. Step-by-step setup
4. Training
5. Evaluation & statistical validation
6. Citation
7. License
---
## 1. Repository structure
```
ahlr-vt/
├── README.md
├── requirements.txt
├── LICENSE
├── .gitignore
├── vocab.json
├── src/
│ ├── __init__.py
│ ├── dependency_check.py
│ ├── dataset.py <- loads AHLD-29K from Hugging Face, builds vocab, PyTorch Dataset
│ ├── model.py <- HybridCNNViT architecture + variant registry (depth 2/4/6/8/12)
│ ├── train.py <- training loop with real early stopping (CLI entry point)
│ ├── evaluate.py <- CTC metrics/decoding, per-line logged evaluation, efficiency profiling
│ └── stats.py <- bootstrap CI, paired significance tests, confusion analysis, length robustness, greedy-vs-beam (CLI entry point)
├── ablation_suite/ # Ablation & Depth Comparison/Study
│ ├── ahlr_vt_pipeline.py # Consolidated pipeline (Hybrid & Pure-ViT)
│ └── README.md # Execution instructions
├── checkpoints/ <- created automatically; holds *.pth files
├── results/ <- created automatically; holds all output CSVs
└── runs/ …