Views
No views yet
larngear_AntOCR
(the _CRNN architecture + input normalization + CTC decode that these weights
are shape-locked to), used in production by larngear-docling.| File | What |
|---|---|
best.pt | CRNN weights — plain state_dict, load with torch.load(weights_only=True) |
classes.json | charset, {"chars": [...]} — 254 chars (Thai + Latin + accents + digits + punctuation) |
len(chars) + 1 (the +1 is the CTC blank) is
the model's output dimension. A mismatched pair decodes to garbage — always pull
both from the same revision.| Benchmark | CER |
|---|---|
| AntOCR real-PDF line bench (3502 lines) | ~4.3% |
larngear-docling control corpus — region-aligned text CER (~20 pages, born-digital Thai PDFs) | 2.34% |
1from huggingface_hub import hf_hub_download
2from antocr.core import CRNNLineRecognizer # from larngear_AntOCR
3
4repo = "jsaksrisuwan/larngear_antocr_weight"
5weights = hf_hub_download(repo, "best.pt", revision="main")
6classes = hf_hub_download(repo, "classes.json", revision="main")
7
8rec = CRNNLineRecognizer(weights=weights, classes=classes)
9texts = rec.recognize_batch([line_crop0, line_crop1, ...]) # grayscale np.uint8 cropslarngear-docling does layout detection + line-crop before calling this.
Pin revision to a tag or commit SHA for reproducible deploys.