ThakiOCR-KOEN-G2M-R3

A Korean/English text-line recognizer (8.93 M parameters, CTC). It is the third round of the G2M line: the same network as ThakiOCR-KOEN-G2M-R2, trained 30,000 more steps from the R2 weights with a second source of real document images added to the training mix. It reads one cropped text line and returns its transcription. It does not find text on a page; pair it with a line detector or layout model.

Korean card: MODEL_CARD.ko.md carries the same facts in Korean.

What changed versus G2M-R2. On our four real-document development sets, character error rate (CER) went down a little: text lines 8.37% → 8.16%, words 8.53% → 8.31%, official validation crops 4.17% → 4.09%, held-out volumes 4.46% → 4.38%. On the two synthetic sets it went up slightly: Korean 5.36% → 5.43% (+0.07 pp), English 4.59% → 4.64% (+0.05 pp). The gains are about 0.1–0.2 percentage points, measured once with one seed on development sets. They are not an independent test result.

Status: research preview, not a product release. Production use is NO-GO. The R2 repository is kept unchanged so both versions can be compared.

Quick start

pip install torch numpy pillow safetensors
python inference.py line.png              # one or more line images
python inference.py --demo                # renders an English line and reads it back
from inference import ThakiOCR
ocr = ThakiOCR(".", device="cpu")
print(ocr.recognize(["line1.png", "line2.png"]))

inference.py is self-contained (torch, numpy, Pillow, safetensors). Its code is the same as in the R2 release (only the model name in the docstring differs); only the weights differ. The vendored network was checked against the training code on these weights before upload (maximum logit difference below 1e-4, identical argmax).

Files

File Content
model.safetensors fp32 weights (state_dict only, no optimizer state)
config.json architecture, preprocessing and decoding settings, provenance hashes
vocab.json 14,250 characters, the same vocabulary as R2; CTC index i maps to chars[i-1], index 0 is blank
inference.py standalone model code, preprocessing, greedy CTC decoding, CLI
LICENSE Apache-2.0 (code and weights)
NOTICE data attribution (CC BY 4.0, SIL OFL 1.1 fonts, AI Hub) and what is not included

Results versus G2M-R2

CER after Unicode NFC, greedy CTC decoding, single run, single seed. Lower is better. The R2 weights were scored at the start of the first R3 training job, the R3 weights at the end of the second; both jobs used byte-identical development manifests (checked by SHA-256) and the same scoring code.

Dev set What it is Rows G2M-R2 G2M-R3 Change (pp)
real_ival_line AI Hub 71299, internal validation lines held out of the Training split 2,895 8.37% 8.16% −0.21
real_ival_word AI Hub 71299, internal validation words held out of the Training split 5,000 8.53% 8.31% −0.22
gold_dev AI Hub 71299 official Validation split, word and line crops (never trained on) 5,000 4.17% 4.09% −0.08
hold_line AI Hub 71299, lines from volumes held out of training 4,000 4.46% 4.38% −0.08
ko_val NVIDIA synthetic Korean lines, validation split 5,000 5.36% 5.43% +0.07 (worse)
en_val NVIDIA synthetic English lines, validation split 5,000 4.59% 4.64% +0.05 (worse)
a1_dev ThakiCloud synthetic symbol lines (currency, dates, circled and masked digits) 5,229 0.28% 0.25% −0.03

Reading the table:

  • The real-image gains are small. We did not compute confidence intervals and do not claim they are significant.
  • R3 is not better on every metric. Synthetic Korean and English lines got slightly worse, and a sibling candidate trained in the same round with capture augmentation (not published) reached a lower CER on real text lines than R3 while being worse on words and synthetic lines.
  • These are development sets. They were used to choose this checkpoint among candidates, so they are not independent test sets. The independent sets reported on the Preview card were not re-run for this release.

Information only, same source as new training data. We also scored line crops from three AI Hub 632 form templates whose pages were not used for training (10,392 lines). CER went from 10.88% (R2) to 6.20% (R3). R3 was trained on other templates of the same dataset and R2 never saw it, so this mostly shows adaptation to that form family, not general improvement. It was not used to select the checkpoint.

How R3 was trained

  • Start: the G2M-R2 weights (120,000 cumulative steps). Weights only: the optimizer was re-created.
  • Two stages from that start, same recipe: a 10,000-step pilot, then 20,000 more steps from the pilot (30,000 added steps, 150,000 cumulative). Each stage: batch 128, AdamW with weight decay 0.02, 500 warmup steps then cosine decay, peak learning rate 1e-4, seed 42, one B200 GPU. Total 1.68 GPU-hours.
  • What changed versus R2 is only the training mix. A second real source was added: the official Training split of AI Hub dataset 632 (financial-domain document OCR), 9 form templates, 9,986 pages, 289,290 unique line crops and 79,568 word crops. The share of AI Hub 71299 real lines was reduced so each of its 28,061 line crops was repeated about 25 times in this round instead of about 115 times in R2.
  • Data mix by samples drawn (3.84 M in total): NVIDIA synthetic Korean lines 24.5%, NVIDIA synthetic English lines 10.5%, AI Hub 71299 Training lines 18%, AI Hub 71299 Training words 2%, ThakiCloud synthetic symbol lines 15%, AI Hub 632 Training lines 25.5%, AI Hub 632 Training words 4.5%. No augmentation.
  • No training image is an evaluation image (checked by image SHA-256; zero overlap), and no page cluster of the held-out 632 templates is in training.
  • Selection: the rules (pilot vs extension, and between two tracks) were written down before the extension ran. The extension was kept because it did not regress the pilot on real lines or words. Among the two tracks, this one was chosen because its synthetic regression was smaller.
  • Checkpoint: the final step.
  • No training data is distributed. AI Hub originals and derived crops stay on ThakiCloud domestic storage; this repository holds weights and code only.

Known limitations

  • Small gain, single seed, development sets only. The improvements are 0.08 to 0.22 percentage points, from one training run. Run-to-run variance was not measured, and no independent test set was opened for this release.
  • Synthetic regression. Synthetic Korean and English lines are slightly worse than R2 (+0.07 and +0.05 pp).
  • Short real text. Very short fields (three characters or fewer) are where this model line is weakest; on R2 real lines of that length had CER above 30%. This was not re-analysed for R3.
  • Dates. Dates written with inner spaces (YYYY. M.DD) remain a known weakness inherited from earlier rounds.
  • ₩ versus ₩. The two won signs look almost the same in the fonts we used. If you need the exact code point, do not rely on this model; if you only need the currency meaning, map both to KRW in post-processing (do not apply NFKC to whole strings).
  • Critical fields in financial and contract documents. Do not use this model to process critical fields (amounts, account or ID numbers, dates, contract terms) automatically. Keep a human review step.
  • Domain. Printed public documents, financial forms and synthetic renderings. Photographed, handwritten, low-contrast or stylized text is out of scope.
  • Line input only. A whole page or a multi-line block produces garbage. Lines wider than 2048 px after resizing are rejected.
  • Batch effects. White padding at line ends is visible to the depthwise convolution, so output can change slightly with the other lines in a batch.
  • No training data in this repository. No AI Hub images, crops, labels or caches are included.

Model

Same architecture and preprocessing as G2M-Preview and G2M-R2:

  • Input: one grayscale text-line image. EXIF transpose, resize to height 48 keeping the aspect ratio (bilinear), width max(8, round(w*48/h)), pixels scaled to [-1, 1] (x/127.5 - 1). A batch is right-padded with white to a multiple of 16.
  • Encoder: convolutional stem (160 channels), mean pooling over height, projection to 320 dims, six blocks of depthwise 1-D convolution (kernel 5) with a gated feed-forward, LayerNorm.
  • Head: dense linear layer to 14,251 classes (14,250 characters + blank); one Hangul syllable = one class.
  • Decoding: greedy CTC. No language model.
  • Parameters: 8,926,251. CPU latency for one 512-px-wide line with 4 threads: about 15 ms (p50).
  • Label normalization: Unicode NFC and no-break space to space. NFKC is not applied.

Intended use

Research on Korean/English line recognition inside a larger document pipeline. Not for unattended reading of financial, legal or identity documents.

License and attribution

Code and weights: Apache-2.0 (see LICENSE). Data attribution: NVIDIA OCR-Synthetic-Multilingual-v1 (CC BY 4.0); fonts under SIL OFL 1.1 for synthetic rendering; AI Hub (AI-Hub) — OCR data (public) (71299) and AI Hub (AI-Hub) — Financial-domain document OCR (632), Training splits used for training under the AI Hub usage policy. The AI Hub data is not redistributed and may not be redistributed; this repository contains no AI Hub data. Details in NOTICE.

Downloads last month
29
Safetensors
Model size
8.93M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for ThakiCloud/ThakiOCR-KOEN-G2M-R3

Finetuned
(1)
this model

Dataset used to train ThakiCloud/ThakiOCR-KOEN-G2M-R3

Collection including ThakiCloud/ThakiOCR-KOEN-G2M-R3