Saltar al contenido
ModelPublicadoExterno
Descargar

Thai Id Ocr Crnn Thai Reader

> MVP model. Production upgrade: swap to ppocrv5 variant (same interface, > better accuracy). See config.json → architecturevariant for programmatic detection.

TipoOtherVersiónRevision 5d4e8f3Bcalidad

Fuente del modelo

Tipo
Other
Tamaño del archivo
11,7 MB
Versión
vRevision 5d4e8f3
Actualizado
18 sept 2026
Descargas
36
Fuente
Hugging Face

Extracto de la fuente

MVP model. Production upgrade: swap to ppocrv5 variant (same interface, > better accuracy). See config.json → architecturevariant for programmatic detection.

Fuentes

1 fuente
Hugging FacePrincipalVersión 5d4e8f38b84fffd482646d8fde2834540cf15229
huggingface.co/chayuto/thai-id-ocr-crnn-thai-reader/tree/5d4e8f38b84fffd482646d8fde2834540cf15229

Verificado 3 sept

Artefactos del modelo

1 artefacto

model.pt

pt · 11,7 MB · SHA-256 f44239ee1f07…3d21 · Hugging Face

Download file

Extractos de fuentes

2 extractos

--- library_name: pytorch license: mit language: - th - en tags: - ocr - text-recognition - thai-id-card - crnn - ctc - on-device - mobile - thai-ocr - thai-script pipeline_tag: image-to-text --- # Thai ID Nano OCR — Thai OCR Reader (SimpleCRNN (MVP)) > **MVP model.** Production upgrade: swap to `ppocrv5` variant (same interface, > better accuracy). See `config.json` → `architecture_variant` for programmatic detection. CTC-based text recognition model for Thai National ID card **thai** fields, designed for on-device inference at 30fps on mobile. | Metric | Value | |--------|-------| | Architecture | SimpleCRNN (MVP) | | Variant | `crnn` | | ExactMatch | 95.3% | | CharAccuracy | 99.1% | | Parameters | 3,059,535 | | Vocab size | 79 | | Best epoch | 116 | ## Quick Start ```python from huggingface_hub import hf_hub_download model_path = hf_hub_download("chayuto/thai-id-ocr-crnn-thai-reader", "model.pt") vocab_path = hf_hub_download("chayuto/thai-id-ocr-crnn-thai-reader", "vocab.txt") config = hf_hub_download("chayuto/thai-id-ocr-crnn-thai-reader", "config.json") ``` ## Architecture **SimpleCRNN** — CNN (4-layer) + BiLSTM (2-layer) + CTC decoder. ``` Input: [B, 3, 48, 320] (RGB, normalized to [-1, 1]) → CNN: 32→64→128→256 channels, BatchNorm+ReLU, MaxPool(2,2)×3 → AdaptiveAvgPool2d((1, None)) → T=40 time steps → BiLSTM: hidden=256, layers=2, dropout=0.1 → Linear(512 → 79) → CTC decode (blank=0, collapse repeats) Output: Unicode string ``` ## Field Details - **Zone:** `text_thai_zone` (names, addresses, dates, religion) - **Charset:** 42 consonants + 16 vowels + 7 marks + Arabic digits + punctuation (78 chars + CTC blank) - **FP16 recommended** for tone mark preservation at quantization - **v2:** Fixed 78-char vocab, 95.3% ExactMatch, 99.1% CharAcc ## Input Preprocessing ```python import cv2 import numpy as np def preprocess(img_path, height=48, max_width=320): img = cv2.imread(img_path) h, w = img.shape[:2] ratio = height / h new_w = min(int(w * ratio), max_width) img = cv2.resize(img, (new_w, height)) # Pad to max_width with white if new_w < max_width: pad = np.full((height, max_width - new_w, 3), 255, dtype=np.uint8) img = np.concatenate([img, pad], axis=1) # Normalize to [-1, 1] img = img.astype(np.float32) / 255.0 img = (img - 0.5) / 0.5 return np.transpose(img, (2, 0, 1)) # CHW ``` ## CTC Decoding ```python de...

Source context: 36 downloads · 0 likes · Pipeline image-to-text · Library pytorch · Repo chayuto/thai-id-ocr-crnn-thai-reader