Ir para o conteúdo
ModelListadosExterno
Baixar

Thai Id Ocr Crnn Numeric Reader

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

TipoOtherVersãoRevision 8ee084cBnota

Fonte do modelo

Tipo
Other
Tamanho do arquivo
11,6 MB
Versão
vRevision 8ee084c
Atualizado
18 de set. de 2026
Downloads
47
Fonte
Hugging Face

Trecho da fonte

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

Fontes

1 fonte
Hugging FacePrimárioVersão 8ee084c930d17637dc9aa6cdba12301080ae26ae
huggingface.co/chayuto/thai-id-ocr-crnn-numeric-reader/tree/8ee084c930d17637dc9aa6cdba12301080ae26ae

Verificado 3 de set.

Artefatos de modelo

1 artefato

model.pt

pt · 11,6 MB · SHA-256 2523ecb292d3…992f · Hugging Face

Baixar

Trechos de fonte

2 trechos

--- library_name: pytorch license: mit language: - th - en tags: - ocr - text-recognition - thai-id-card - crnn - ctc - on-device - mobile - numeric-ocr - citizen-id pipeline_tag: image-to-text --- # Thai ID Nano OCR — Numeric 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 **numeric** fields, designed for on-device inference at 30fps on mobile. | Metric | Value | |--------|-------| | Architecture | SimpleCRNN (MVP) | | Variant | `crnn` | | ExactMatch | 98.6% | | CharAccuracy | 99.4% | | Parameters | 3,026,703 | | Vocab size | 15 | | Best epoch | 10 | ## Quick Start ```python from huggingface_hub import hf_hub_download model_path = hf_hub_download("chayuto/thai-id-ocr-crnn-numeric-reader", "model.pt") vocab_path = hf_hub_download("chayuto/thai-id-ocr-crnn-numeric-reader", "vocab.txt") config = hf_hub_download("chayuto/thai-id-ocr-crnn-numeric-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 → 15) → CTC decode (blank=0, collapse repeats) Output: Unicode string ``` ## Field Details - **Zones:** `num_id_zone` (13-digit CID), `num_dob_zone` (DD/MM/YYYY) - **Charset:** `0123456789/- .` (14 chars + CTC blank) - **Post-validation:** CID Modulo 11 checksum on digit 13 ## 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 def ctc_decode(indices, vocab_chars, blank_idx=0): chars, prev = [], -1 for idx in indices: if id...

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