--- language: - my - pi language_details: "my (Burmese), pi (Pali in Burmese script)" license: cc-by-4.0 library_name: kraken tags: - ocr - burmese - pali - text-recognition - kraken - myanmar pretty_name: Burmese Kraken OCR --- # Burmese Kraken OCR A Kraken recognition model for **Burmese and Pali (in Burmese script)** text line recognition. Trained from scratch on 897,883 rendered line images with augmentation for real-world robustness. ## Model Description - **Architecture**: CRNN (4 conv layers + 3× bidirectional LSTM(200) + linear output) - **Parameters**: 4.0M - **Alphabet**: 118 characters (Burmese consonants, vowels, tones, medials, digits, Pali combinations, punctuation) - **Input**: grayscale/bi-level line image, height normalized to 120px - **Output**: CTC-decoded Burmese/Pali text ## Performance Evaluated on 10 held-out page images (6 modern Burmese, 4 Pali/nissaya): | Category | CER | |----------|-----| | **Overall** | **0.77%** | | Modern Burmese | 0.92% | | Pali/nissaya | 0.60% | ## Training Details - **Training data**: 718,515 lines (80% clean, 20% degraded with skew, speckle, blur, strokes, page-curve, perspective) - **Dataset**: [`pndaza/burmese-kraken-1m`](https://huggingface.co/datasets/pndaza/burmese-kraken-1m) - **Optimizer**: AdamW, learning rate 0.001 → 0.0001 (fine-tuning phase) - **Precision**: 16-mixed (FP16) - **Hardware**: NVIDIA RTX 5090 (vast.ai) - **Val accuracy**: 0.9785 ## Usage ### Command-line (kraken) ```bash # Download the model hf download pndaza/burmese-kraken-ocr burmese_kraken_ocr.safetensors # Run OCR on a page image kraken -i page.png output.txt binarize segment ocr -m burmese_kraken_ocr.safetensors # For dense/degraded images, use the neural baseline segmenter kraken -i page.png output.txt binarize segment -bl ocr -m burmese_kraken_ocr.safetensors ``` ### Python (kraken API) ```python from kraken import blla from kraken.lib import vgsl from kraken.lib.util import open_image # Load model model = vgsl.TorchVGSLModel.load_model("burmese_kraken_ocr.safetensors") # Segment + recognize im = open_image("page.png") seg = blla.segment(im) from kraken import rpred recognizer = rpred.rpred(model, im, seg) result = next(recognizer) print(result) ``` ## Notes - This is a **recognition model** only. Segmentation uses Kraken's default `blla.mlmodel` baseline segmenter, which works well for most documents but may produce errors on dense Burmese text with deep descenders. - Line images are rendered, not scanned. The training data includes degraded augmentations to bridge the domain gap, but performance on real scans may vary. - For the **general-purpose image dataset** (not Kraken format), see [`pndaza/burmese-ocr-1m`](https://huggingface.co/datasets/pndaza/burmese-ocr-1m).