--- language: - km tags: - ocr - khmer - text-recognition - image-to-text library_name: pytorch pipeline_tag: image-to-text --- # Netra OCR V2 — Khmer Text Recognition (Phase A, in progress) Khmer text recognizer over character-cluster (KCC) tokens, based on *Towards Universal Khmer Text Recognition* (Kong et al.) and extended to address both limitations raised in the paper's §6: a **supervised MAFS modality router** and a **learned decoder router**. Code: https://github.com/NDarayut/Netra-OCR-V2 ## ⚠️ Status — this is not a finished model `phase_a_epoch26.pt` is a **mid-training snapshot**: Phase A (document/printed pretraining) at epoch 26, and **Phase B (scene & handwritten adaptation) has not been run**. It is published for checkpointing and reproducibility, not for use. **No accuracy numbers are claimed.** The model has not been evaluated on the held-out test sets, and it has seen essentially no scene-text or handwritten data yet — expect it to perform poorly outside clean printed documents. Do not deploy this for anything that matters. ## Architecture ``` image → CBAM-refined VGG backbone → Transformer encoder → MAFS → ┬→ AR decoder (accurate) └→ CTC head (fast) ``` - 22.6M parameters, float32. - Input height 48px, chunked at width 100 with 16px overlap. - Trained jointly with `l_Total = l_CTC + l_TR`; the AR decoder uses a 30% input-token masking regularizer. - MAFS router: 5 slots, first 3 supervised against per-source document / scene / handwritten labels. ## Files | File | Contents | |---|---| | `phase_a_epoch26.pt` | `{"model": state_dict, "epoch": 26, "phase": "a"}` — inference weights only | Optimizer and scheduler state are **not** included, so this checkpoint cannot be used to resume training. ## Usage ```python import torch from netra_ocr_v2.config import OCRConfig from netra_ocr_v2.model import KhmerOCR ck = torch.load("phase_a_epoch26.pt", map_location="cpu") model = KhmerOCR(OCRConfig()) model.load_state_dict(ck["model"]) model.eval() ``` See the [repo](https://github.com/NDarayut/Netra-OCR-V2) for preprocessing and the predictor. ## Training data Ten Khmer OCR sources from the Hub — the work of their respective authors, including datasets from `SoyVitou`, `seanghay`, `KrorngAI`, `LazyGreed`, `KiteAether`, plus Google Research's HierText. The full split with modality labels is in `dataset_split.md` in the repo. Please credit those authors if you build on this. ## Citation Base architecture: Kong et al., *Towards Universal Khmer Text Recognition*. Also builds on CBAM (Woo et al. 2018), Mask-Predict (Ghazvininejad et al. 2019), and blockwise parallel decoding (Stern et al. 2018).