sengtha commited on
Commit
bf131af
ยท
verified ยท
1 Parent(s): 242ba02

Upload 3 files

Browse files
Files changed (3) hide show
  1. README (3).md +75 -0
  2. det.onnx +3 -0
  3. rec.onnx +3 -0
README (3).md ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - km
5
+ library_name: onnx
6
+ tags:
7
+ - ocr
8
+ - khmer
9
+ - text-detection
10
+ - text-recognition
11
+ - onnxruntime
12
+ - on-device
13
+ pipeline_tag: image-to-text
14
+ ---
15
+
16
+ # Khmer OCR (ONNX) โ€” mirror for iAny
17
+
18
+ On-device **Khmer optical character recognition**: a text **detector** + a text
19
+ **recognizer**, both in ONNX, that read Khmer (and Latin) text out of photos and
20
+ scanned pages โ€” fully offline, in the browser (onnxruntime-web) and on mobile
21
+ (onnxruntime-react-native).
22
+
23
+ This repository is a **verbatim mirror** of the models from
24
+ [**seanghay/KhmerOCR**](https://github.com/seanghay/KhmerOCR) (MIT), re-hosted so
25
+ the [iAny](https://github.com/sengtha/iAny) app can download them from a stable
26
+ URL. **The model weights are unmodified** โ€” all credit for training goes to
27
+ [Seanghay Yath](https://github.com/seanghay). Only the app's TypeScript
28
+ pre/post-processing was re-implemented from the reference Python.
29
+
30
+ ## Files
31
+
32
+ | File | Size | SHA-256 |
33
+ | --- | --- | --- |
34
+ | `det.onnx` | 10,867,112 B | `61fb440d2eecd561a4d5ccd41e3be5a14a882643f1ac0e1f05f9f53ff9098e67` |
35
+ | `rec.onnx` | 13,801,555 B | `931e3c960815a6119731d63759eac2ef800318bf131b8a92fecdb580fbbf1e65` |
36
+
37
+ ## Models
38
+
39
+ ### `det.onnx` โ€” text detector (YOLO-style, opset 12)
40
+ - **Input:** `images` โ€” `float32[1, 3, 1024, 1024]`, RGB, letterboxed (aspect
41
+ preserved, top-left, black padding), values `/255`.
42
+ - **Output:** `output0` โ€” `float32[1, 6, 21504]` โ†’ per anchor
43
+ `[cx, cy, w, h, score_class0, score_class1]`.
44
+ - **Classes:** `0` = figure/image region, `1` = text line.
45
+ - Post-process: score threshold, xywhโ†’xyxy, NMS, divide by the letterbox ratio.
46
+
47
+ ### `rec.onnx` โ€” text recognizer (CRNN + CTC, opset 14)
48
+ - **Input:** `input` โ€” `float32[batch, 1, 32, width]`, grayscale (ITU-R 601-2
49
+ luma), height 32, width proportional, values `/255`.
50
+ - **Outputs:**
51
+ - `logits` โ€” `float32[seq_len, batch, 102]` (CTC; class `0` = blank).
52
+ - `font_logits` โ€” `float32[batch, 6]` (font-style classifier).
53
+ - Greedy CTC decode: argmax per step, collapse repeats, drop blanks. Class `i`
54
+ maps to glyph `TOKENS[i - 3]` (classes `1`โ€“`2` are special / unused).
55
+
56
+ **Charset (`TOKENS`, 99 glyphs):**
57
+
58
+ ```
59
+ แž€แžแž‚แžƒแž„แž…แž†แž‡แžˆแž‰แžŠแž‹แžŒแžแžŽแžแžแž‘แž’แž“แž”แž•แž–แž—แž˜แž™แžšแž›แžœแžแžžแžŸแž แžกแžขแžฃแžคแžฅแžฆแžงแžฉแžชแžซแžฌแžญแžฎแžฏแžฐแžฑแžฒแžณแžถแžทแžธแžนแžบแžปแžผแžฝแžพแžฟแŸ€แŸแŸ‚แŸƒแŸ„แŸ…แŸ†แŸ‡แŸˆแŸ‰แŸŠแŸ‹แŸŒแŸแŸŽแŸแŸแŸ‘แŸ’แŸ”แŸ•แŸ–แŸ—แŸ˜แŸ›แŸแŸ แŸกแŸขแŸฃแŸคแŸฅแŸฆแŸงแŸจแŸฉแŸณ
60
+ ```
61
+
62
+ **Font styles (`font_logits`):** `Regular, Italic, Bold, BoldItalic, Moul, MoulLight`.
63
+
64
+ ## Intended use
65
+
66
+ Offline Khmer document/photo OCR on low-end devices. Works best on reasonably
67
+ clean, straight-on images with a real text layer of printed Khmer. Scanned/photo
68
+ quality (skew, lighting, blur) affects accuracy; there is no OCR fallback for
69
+ image-only content beyond these models.
70
+
71
+ ## License & attribution
72
+
73
+ **MIT.** Original models and training ยฉ [Seanghay Yath](https://github.com/seanghay),
74
+ from [seanghay/KhmerOCR](https://github.com/seanghay/KhmerOCR). Redistributed
75
+ unmodified under the MIT License; this mirror claims no authorship of the weights.
det.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:61fb440d2eecd561a4d5ccd41e3be5a14a882643f1ac0e1f05f9f53ff9098e67
3
+ size 10867112
rec.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:931e3c960815a6119731d63759eac2ef800318bf131b8a92fecdb580fbbf1e65
3
+ size 13801555