janakhpon commited on
Commit
761280d
·
verified ·
1 Parent(s): 5156ac5

v3.5: 160px, 277 classes, static width, gated ONNX and CoreML exports

Browse files

Replaces the v2 network on main. Not a drop-in: input height 128 -> 160, output classes 316 -> 277, charset 315 -> 276, and the width axis goes from dynamic to a static 1024 because attention fixes the sequence length at trace time. Revision a51be11 still serves v2 and is unaffected.

Both exports are gated against the PyTorch model on a seeded uniform [-1,1] input: ONNX on logits at rtol=atol=1e-3, CoreML on logits at 1e-3 and on an identical decoded string. The CoreML gate runs CPU-only, so on-device numerics are unverified.

No held-out evaluation exists for this model. The card states what the 0.0210 selection metric is and is not.

README.md CHANGED
@@ -14,131 +14,162 @@ tags:
14
  - crnn
15
  ---
16
 
17
- # MonOCR: Production-Ready Mon Language OCR
18
 
19
- MonOCR is an Optical Character Recognition (OCR) model engineered for the Mon language (mnw). Optimized for performance and accuracy, it accurately recognizes Mon characters from documents, digital texts, and scene images.
 
 
20
 
21
- This repository serves as the official distribution point for MonOCR model weights in deployment-ready formats.
 
 
 
22
 
23
- ## Software Development Kits
 
 
 
24
 
25
- SDKs for four languages handle model caching, image preprocessing and inference.
26
- Each pins this repository at a fixed revision rather than tracking `main`, so an
27
- update here does not change what an installed SDK downloads.
28
-
29
- | SDK | Platform | Install from | Published version |
30
- | :--- | :--- | :--- | :--- |
31
- | [monocr-onnx](https://github.com/MonDevHub/monocr-onnx/tree/main/python) | Python | PyPI | 0.1.0 |
32
- | [monocr](https://github.com/MonDevHub/monocr-onnx/tree/main/js) | Node.js | npm | 0.1.5 |
33
- | [monocr-go](https://github.com/MonDevHub/monocr-onnx/tree/main/go) | Go | Go module proxy | v0.1.1 |
34
- | [monocr-rust](https://github.com/MonDevHub/monocr-onnx/tree/main/rust) | Rust | git dependency | not on crates.io |
35
 
36
- Versions verified against the registries on 2026-08-15. The table previously
37
- carried a fourth column under a three-column header, so it rendered as a
38
- malformed row, and every entry read "Production" — including the Rust binding,
39
- which has never been published to a registry.
40
 
41
- ## Model Checkpoints
 
42
 
43
- | Format | Path | Intended Use Case |
44
- | :---------------- | :---------------------- | :------------------------------------------------- |
45
- | **ONNX** | `onnx/monocr.onnx` | Standard deployments (Server/Desktop). |
46
- | **Core ML** | `coreml/monocr.mlpackage`| Apple ecosystem (iOS/macOS/watchOS). |
47
- | **PyTorch** | `pytorch/monocr.ckpt` | Training, fine-tuning, and research. |
48
 
49
- ## Performance Metrics
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
- | Metric | Value |
52
- | :------------------ | :-------------------------------------------------- |
53
- | **Train Loss** | 1.22 |
54
- | **Validation Loss** | 1.157 |
55
- | **CER** | 0.025 |
56
- | **WER** | 0.211 |
57
- | **Epochs** | 27 |
58
- | **Best Checkpoint** | `monocr-epoch=27-val_loss=1.157-val_cer=0.025.ckpt` |
 
 
 
 
59
 
60
- **How these were measured.** CER 0.025 is `val_cer` on the **synthetic validation
61
- split** at epoch 27. The checkpoint published here records it internally
62
- (`monitor: val_cer`, `best_model_score` 0.0252, step 218,949), so the figure is
63
- attributable to this artifact. Two things it is not: it is a *validation* number
64
- rather than a held-out test number, and its split was rendered by the same
65
- generator **and the same typefaces** as training — font-disjoint splits were
66
- introduced after this checkpoint was trained. It therefore measures fit to unseen
67
- *text* in fonts the model had already seen, which is a substantially easier task
68
- than reading an unseen typeface.
69
 
70
- **WER 0.211 has no recorded provenance.** It could not be traced to this
71
- checkpoint or to any training record, and it should be treated as unverified
72
- until re-measured.
73
-
74
- No figure on this card describes accuracy on a photographed page.
75
-
76
- ## Dataset Summary
77
-
78
- - **Total samples**: 3,030,000
79
- - **Train size**: 3,000,000
80
- - **Validation size**: 30,000
81
- - **Data source description**: Procedural synthetic text generation across multiple Mon fonts combined with real-world digit corpuses.
82
- - **Augmentation strategy**: Applied during training: image-level augmentations including noise, blur, and transformations.
83
-
84
- ## Model Specifications
85
-
86
- - **Architecture type**: MobileNetV3-Large Backbone + 2-layer BiLSTM + Linear CTC Head
87
- - **Parameter count**: 6.58M parameters
88
- - **Model size**: 100.73 MB (PyTorch Checkpoint)
89
- - **Training hardware**: NVIDIA GPU (Single GPU run)
90
- - **Training time**: ~2-4 days
91
-
92
- ## Reproducibility
93
-
94
- - **Optimizer**: AdamW
95
- - **Learning rate**: 0.0001 (Warmup + Cosine Annealing)
96
- - **Batch size**: 48 (with Gradient Accumulation = 4)
97
- - **Loss function**: CTCLoss (with label smoothing $\epsilon=0.1$)
98
-
99
- ## Technical Specification
100
-
101
- - **Input Tensors**: Grayscale (1-channel), float32, fixed 128px height. The ONNX graph is `[1, 1, 128, width]`: batch is fixed at 1 and the **width axis is dynamic**.
102
- - **Image Preprocessing**: Aspect-ratio preserving resize to 128px height, then `pixel / 127.5 - 1.0` into the `[-1, 1]` range. Where padding is used it must be **white** — `+1.0` after normalization, not `0.0`. Training padded to 1024px width; since the width axis is dynamic, 1024 is the width the model was trained at rather than a required input size.
103
- - **Decoding Strategy**: Connectionist Temporal Classification (CTC) Greedy Decoding (Default).
104
- - **Vocabulary**: 315 characters (Mon, Burmese, digits, punctuation, and symbols). Encoding is standard UTF-8 (see `charset.txt`).
105
-
106
- ## Integration Guidelines
107
-
108
- For developers building custom drivers:
109
-
110
- 1. Refer to `charset.txt` for the index-to-character mapping (Index 0 is reserved for `<blank>`).
111
- 2. Ensure input images are high-contrast and properly scaled to 128px height.
112
- 3. The ONNX width axis is dynamic, so crops of differing width can be fed directly without padding to 1024. Batch is fixed at 1.
113
- 4. Read `num_classes` from the JSON sidecar and check it equals `len(charset) + 1` before decoding. If the two disagree, the model will still return confident text — it will just be the wrong text, with no error raised.
114
-
115
- ## Limitations — what no number here covers
116
-
117
- Stated so that an unmeasured property is not read as a measured one:
118
-
119
- - **Real photographs.** Every evaluation sample was synthetic, rendered by the
120
- same generator the model trained on. The reported CER measures generalisation
121
- to unseen text, not to an unseen renderer. A defect in the renderer is learned,
122
- validated against and tested against identically, and scores well throughout.
123
- - **Unseen typefaces.** This checkpoint's validation split shared its fonts with
124
- training, so no figure here separates typographic generalisation from text
125
- generalisation.
126
- - **Page layout and line segmentation.** Inputs are pre-cropped single lines.
127
- - **Handwriting.** Not covered.
128
- - **Beam-search decoding.** Greedy only; the reported figures are greedy.
129
- - **Per-line latency.** No latency tail has been measured.
130
-
131
- ## License
132
-
133
- All model weights and metadata are provided under the MIT License.
134
 
135
  ## Citation
136
 
137
  ```bibtex
138
- @software{monocr2026,
139
- author = {Janakh},
140
- title = {MonOCR: Production-Ready OCR for Mon Language},
141
- year = {2026},
142
- url = {https://huggingface.co/janakhpon/monocr}
143
  }
144
  ```
 
14
  - crnn
15
  ---
16
 
17
+ # MonOCR — line-level OCR for Mon (mnw)
18
 
19
+ A CRNN that reads one line of Mon text and returns a string. Mon is classified by
20
+ UNESCO as a vulnerable language, and this is the model, the charset and the export
21
+ artifacts around it.
22
 
23
+ **Read the two sections marked "what this number is not" before quoting anything
24
+ from this card.** This model has no held-out evaluation. What it has is a
25
+ training-time selection metric and a like-for-like comparison against the model
26
+ it replaces, and those are different things.
27
 
28
+ ## What changed at v3.5, and what it breaks
29
+
30
+ This revision replaces the v2 network. **It is not a drop-in.** Four parts of the
31
+ contract moved:
32
 
33
+ | | v2 (revision `a51be11`) | v3.5 (this revision) |
34
+ |---|---|---|
35
+ | Input height | 128 | **160** |
36
+ | Input width | **dynamic** — any width accepted | **static 1024** |
37
+ | Batch axis | fixed at 1 | **dynamic** |
38
+ | Output classes | 316 | **277** |
39
+ | Charset | 315 characters | **276 characters** |
40
+ | Parameters | 6,575,868 | **11,553,437** |
 
 
41
 
42
+ The width axis is the one that catches integrations. v2's graph accepted a crop
43
+ of any width; v3.5 accepts 1024 and nothing else. `nn.MultiheadAttention` fixes
44
+ the sequence length when the graph is traced, so a declaration of anything wider
45
+ would be a promise the artifact cannot keep. **Resize to 1024 before calling.**
46
 
47
+ If you are pinned to `a51be11` you are unaffected — that revision still serves v2
48
+ and always will. Move deliberately.
49
 
50
+ ## Files
 
 
 
 
51
 
52
+ | Path | What |
53
+ |---|---|
54
+ | `onnx/monocr.onnx` | ONNX FP32, opset 17, 46,247,040 bytes |
55
+ | `onnx/monocr.json` | sidecar: charset, geometry, class count, normalization contract |
56
+ | `onnx/charset.txt` | the 276 characters, index 1..276; **first character is U+0020** |
57
+ | `coreml/monocr.mlpackage` | Core ML, FP32 |
58
+ | `coreml/monocr.mlpackage.json` | its sidecar |
59
+ | `pytorch/monocr.pt` | EMA-merged inference weights, 46,348,409 bytes |
60
+ | `charset.txt`, `monocr.json` | copies at the root, for consumers that expect them there |
61
+
62
+ **Load the charset from the same revision as the weights.** They are one contract:
63
+ a charset from another revision decodes every index to the wrong character and
64
+ raises nothing. Strip only `\n` and `\r` — the first class is a space, and a bare
65
+ `.strip()` removes it and shifts every index by one.
66
+
67
+ ## Input contract
68
+
69
+ - Grayscale, 1 channel, float32, shape `[batch, 1, 160, 1024]`
70
+ - Aspect-preserving resize to height 160, then pad the width to 1024
71
+ - Normalize `pixel / 127.5 - 1.0`
72
+ - **Pad with white**, which is `+1.0` after normalization, not `0.0`
73
+ - Greedy CTC decode; index 0 is the blank
74
+
75
+ Feeding raw uint8 in `[0, 255]` produces confident garbage with no error.
76
+
77
+ ## Architecture
78
+
79
+ MobileNetV3-Large + squeeze-excitation neck → band pooling → 2×BiLSTM(512) →
80
+ bottleneck self-attention (256-dim, 4 heads) → Linear(1024 → 277) → CTC.
81
+ 11,553,437 parameters, all trainable.
82
+
83
+ ## Performance, and what these numbers are not
84
+
85
+ ### The selection metric
86
+
87
+ `val_cer` **0.0210**, greedy, at epoch 23 / step 93,645.
88
+
89
+ **What it is not:** an evaluation. Four things travel with it or it says something
90
+ it does not mean.
91
+
92
+ 1. **4,096 lines, not the validation split.** It is a periodic check during
93
+ training, not a pass over the data.
94
+ 2. **One typeface.** Every one of those lines is rendered in a single font.
95
+ 3. **It selected the checkpoint.** The same number drove `save_top_k`, so it
96
+ cannot also be an unbiased estimate of that checkpoint.
97
+ 4. **Synthetic.** Rendered by the same generator the model trained on.
98
+
99
+ **There is no held-out evaluation of this model.** The test split is unspent. No
100
+ number on this card describes accuracy on a photographed page.
101
+
102
+ ### Against v2, on identical images
103
+
104
+ The one comparison that is available and fair. Both generations ship an ONNX
105
+ export, so the same rendered lines go through both graphs with the same
106
+ preprocessing and the same greedy decode. Text is restricted to the **273
107
+ characters both charsets can emit**, so neither model is charged for a character
108
+ it has no class for. 600 lines per arm, rendered 2026-08-15.
109
+
110
+ | Rendered in | n | v2 CER | v3.5 CER | error reduced |
111
+ |---|---:|---:|---:|---:|
112
+ | the 32 trained designs | 600 | 0.1470 | **0.0396** | 73% |
113
+ | `namkhon`, held out from v3.5 | 600 | 0.0521 | **0.0188** | 64% |
114
+ | `pyidaungsu`, `yunghkio`, held out from v3.5 | 600 | 0.0342 | **0.0051** | 85% |
115
+
116
+ The bottom two rows are held out from v3.5 and from nothing for v2 — v2 predates
117
+ font-disjoint splits — so the comparison is tilted against v3.5 and it wins
118
+ anyway. **This is a preview, not an evaluation:** one rendering pipeline reading
119
+ its own output, synthetic for both models. It supports a narrow claim, that v3.5
120
+ reads rendered Mon better than v2, and no broader one.
121
+
122
+ ### Reading a page
123
+
124
+ Wide lines need care. Measured 2026-08-15 over 240 rendered lines wide enough to
125
+ need the choice, median 3 model windows each: squeezing a whole line into the
126
+ 1024px canvas scored **0.1434**, cutting it into canvas-width tiles at whitespace
127
+ columns and joining scored **0.0795**. **Tile wide lines for this model.** The
128
+ opposite is true of v2, where squeezing wins — the direction is a property of the
129
+ network, so re-measure if you swap models.
130
+
131
+ ## Exports, and how they were checked
132
+
133
+ Both exports are gated against the PyTorch model on a seeded uniform `[-1, 1]`
134
+ input, and the gate fails the build:
135
+
136
+ - **ONNX** — logits within `rtol=atol=1e-3`.
137
+ - **Core ML** — logits within `1e-3` **and** an identical CTC-decoded string.
138
+
139
+ The Core ML gate runs on CPU. The Neural Engine computes in fp16 and its compiler
140
+ may reassociate, so what ships to a device is not what was verified. **No device
141
+ latency number exists for this model**, on any platform.
142
+
143
+ ## Limitations
144
 
145
+ - **Real photographs.** Every training sample is synthetic, rendered by one
146
+ generator. A camera photo of physical text is out of domain and fails
147
+ confidently — measured on a whiteboard photo, the model returned fluent Mon at
148
+ confidence 0.83 for text that appears nowhere on the page. **Confidence is not
149
+ a usable filter for this.**
150
+ - **Page layout.** The input is a cropped line. There is no detector and no
151
+ reading-order model.
152
+ - **Handwriting**, except Myanmar digits.
153
+ - **Beam search.** Greedy only in the exported graph.
154
+ - **Latency.** No per-line tail measured, and no on-device number at all.
155
+ - **Typeface coverage.** 35 distinct designs across 79 usable font files bound
156
+ every generalisation claim above.
157
 
158
+ ## Training data
 
 
 
 
 
 
 
 
159
 
160
+ Rendered from a Mon text corpus. **The corpus licensing is not fully settled**:
161
+ one source has no established licence, and CC BY-SA attribution for another
162
+ cannot be reconstructed because per-article URLs were stripped at import. The MIT
163
+ licence on this repository covers the model weights and the code that produced
164
+ them; it does not resolve the provenance of the text they were rendered from.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
 
166
  ## Citation
167
 
168
  ```bibtex
169
+ @misc{monocr,
170
+ title = {MonOCR: line-level OCR for the Mon language},
171
+ author = {Zin Min},
172
+ year = {2026},
173
+ url = {https://huggingface.co/janakhpon/monocr}
174
  }
175
  ```
charset.txt CHANGED
@@ -1 +1 @@
1
- !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~£¥¦§©«¬°±²³´µ·¸¹º»¾ÀÁÂÄÅÆÇÉÊÌÍÑÓÖרÜÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüþĀāıŒœŠšŽžƒːμπကခဂဃငစဆဇဈဉညဋဌဍဎဏတထဒဓနပဖဗဘမယရလဝသဟဠအဢဣဤဥဦဧဨဩဪါာိီုူေဲဳဴဵံ့း္်ျြွှဿ၀၁၂၃၄၅၆၇၈၉၊။၌၍၎၏ၐၑၓၚၛၜၝၞၟၠၡၢၣၤၥၨၪၰၱၲၳၴၵၷၸၹၺၻၼၾၿႀႄႅႆႇႈႉႊႏ႐႒႓႔႕႘႙ႜႝ႟–‘’‚“”•…−
 
1
+ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~£¥¦§©«¬°±²³´µ·¸¹º»¼½¾ÀÁÂÄÅÆÇÉÊÌÍÑÓÖרÜÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüþĀāıŒœŠšŽžƒːπကခဂဃငစဆဇဈဉညဋဌဍဎဏတထဒဓနပဖဗဘမယရလဝသဟဠအဣဤဥဦဧဨဩဪါာိီုူေဲဳဴဵံ့း္်ျြွှဿ၀၁၂၃၄၅၆၇၈၉၊။၌၍၎၏ၐၑၓၚၛၜၝၞၟၠ–—‘’‚“”•…−
coreml/monocr.mlpackage.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "charset": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~£¥¦§©«¬°±²³´µ·¸¹º»¼½¾ÀÁÂÄÅÆÇÉÊÌÍÑÓÖרÜÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüþĀāıŒœŠšŽžƒːπကခဂဃငစဆဇဈဉညဋဌဍဎဏတထဒဓနပဖဗဘမယရလဝသဟဠအဣဤဥဦဧဨဩဪါာိီုူေဲဳဴဵံ့း္်ျြွှဿ၀၁၂၃၄၅၆၇၈၉၊။၌၍၎၏ၐၑၓၚၛၜၝၞၟၠ–—‘’‚“”•…−",
3
+ "img_height": 160,
4
+ "img_width": 1024,
5
+ "model_version": "3.5",
6
+ "format": "mlpackage",
7
+ "architecture": "MobileNetV3-Large + SE + 2xBiLSTM(512) + BottleneckAttention + CTC",
8
+ "num_classes": 277,
9
+ "rnn_hidden_size": 512,
10
+ "rnn_layers": 2,
11
+ "backbone": "mobilenetv3_large",
12
+ "input_normalization": "pixel / 127.5 - 1.0",
13
+ "input_dtype": "float32",
14
+ "input_channels": 1,
15
+ "input_colorspace": "grayscale"
16
+ }
coreml/monocr.mlpackage/Data/com.apple.CoreML/model.mlmodel CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ed6dab1e5efe567ca0dfddec5dca28f6e2d01826b70c4cb967280bcec5ae657a
3
- size 92438
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b8ad3699faf4a4644812c58867ca214997e956f1522a485804c97cbe065fca11
3
+ size 97599
coreml/monocr.mlpackage/Data/com.apple.CoreML/weights/weight.bin CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:6a02f90114e585f4a1f80a24fa85eaa81376af7f1e3fe0d900cdbbeb3a07e7c8
3
- size 24173304
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aaa035c39c34753c2695e3e25766eb3d71d8bf291536244d48b4857206834698
3
+ size 46176000
coreml/monocr.mlpackage/Manifest.json CHANGED
@@ -1,18 +1,18 @@
1
  {
2
  "fileFormatVersion": "1.0.0",
3
  "itemInfoEntries": {
4
- "4AE68C8B-1120-434B-A9B6-1F1E72FB9ACE": {
5
  "author": "com.apple.CoreML",
6
  "description": "CoreML Model Weights",
7
  "name": "weights",
8
  "path": "com.apple.CoreML/weights"
9
  },
10
- "9CCFDE08-4B02-4A5A-A4C7-739C067777A5": {
11
  "author": "com.apple.CoreML",
12
  "description": "CoreML Model Specification",
13
  "name": "model.mlmodel",
14
  "path": "com.apple.CoreML/model.mlmodel"
15
  }
16
  },
17
- "rootModelIdentifier": "9CCFDE08-4B02-4A5A-A4C7-739C067777A5"
18
  }
 
1
  {
2
  "fileFormatVersion": "1.0.0",
3
  "itemInfoEntries": {
4
+ "4B1BEA03-F6E1-4E73-9263-1A15DF6E48E2": {
5
  "author": "com.apple.CoreML",
6
  "description": "CoreML Model Weights",
7
  "name": "weights",
8
  "path": "com.apple.CoreML/weights"
9
  },
10
+ "E70682BC-0A4A-45B0-B67C-83338031F87D": {
11
  "author": "com.apple.CoreML",
12
  "description": "CoreML Model Specification",
13
  "name": "model.mlmodel",
14
  "path": "com.apple.CoreML/model.mlmodel"
15
  }
16
  },
17
+ "rootModelIdentifier": "E70682BC-0A4A-45B0-B67C-83338031F87D"
18
  }
monocr.json CHANGED
@@ -1,17 +1,16 @@
1
  {
2
- "charset": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~£¥¦§©«¬°±²³´µ·¸¹º»¾ÀÁÂÄÅÆÇÉÊÌÍÑÓÖרÜÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüþĀāıŒœŠšŽžƒːμπကခဂဃငစဆဇဈဉညဋဌဍဎဏတထဒဓနပဖဗဘမယရလဝသဟဠအဢဣဤဥဦဧဨဩဪါာိီုူေဲဳဴဵံ့း္်ျြွှဿ၀၁၂၃၄၅၆၇၈၉၊။၌၍၎၏ၐၑၓၚၛၜၝၞၟၠၡၢၣၤၥၨၪၰၱၲၳၴၵၷၸၹၺၻၼၾၿႀႄႅႆႇႈႉႊႏ႐႒႓႔႕႘႙ႜႝ႟–‘’‚“”•…−",
3
- "img_height": 128,
4
  "img_width": 1024,
5
- "model_version": "2.0",
6
- "format": "pytorch",
7
- "architecture": "MobileNetV3-Large + BiLSTM(384) + CTC",
8
- "num_classes": 316,
9
- "rnn_hidden_size": 384,
10
  "rnn_layers": 2,
11
  "backbone": "mobilenetv3_large",
12
  "input_normalization": "pixel / 127.5 - 1.0",
13
  "input_dtype": "float32",
14
  "input_channels": 1,
15
  "input_colorspace": "grayscale",
16
- "_provenance": "Charset repaired 2026-08-14. This sidecar declared a 912-character corpus-scanned charset against a 316-class model, so 150 of the 315 decodable indices mapped to the wrong character and any consumer decoded Mon as Latin/IPA text with no error and no lookup miss. The charset here is the 315-character allowlist read from charset.txt in this repository (git blob 08b1c23299dd1f68f14b7bdb4be586dd52d27c5d); it is byte-identical to the repaired sidecar in mon_OCR data/models/archive-v2-2026-03/, which was confirmed by decoding validation samples against their labels. num_classes is recorded here so this class of mismatch is checkable: CTC reserves index 0 for blank, so num_classes must equal len(charset) + 1. It is confirmed by fc.weight (316, 768) and hyper_parameters['num_classes'] in the published monocr.ckpt. The 912-character string arrived in commit df456df, a Core ML export that overwrote both this file and the root monocr.json with the Core ML variant -- which is also why the ONNX sidecar had lost opset_version and declared format 'mlpackage'. A re-export that writes only one sidecar will reintroduce that. model_version stays '2.0': mon_OCR names this artifact '2.0-legacy' internally, but that string is a judgement relative to unpublished v3.5 code and changing a published contract field could break an exact-match check in the four SDKs the model card lists. The v2 graph takes [1, 1, 128, width] float32 grayscale: batch is fixed at 1 and the width axis is dynamic. img_width 1024 is the width training preprocessing pads to, not a graph constraint -- README.md states both and reads as a contradiction. This file sits beside monocr.ckpt, a PyTorch Lightning checkpoint, so it carries no opset_version; the ONNX sidecar is onnx/monocr.json. It previously declared format 'mlpackage', which described neither this checkpoint nor anything else at the repository root."
17
- }
 
1
  {
2
+ "charset": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~£¥¦§©«¬°±²³´µ·¸¹º»¼½¾ÀÁÂÄÅÆÇÉÊÌÍÑÓÖרÜÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüþĀāıŒœŠšŽžƒːπကခဂဃငစဆဇဈဉညဋဌဍဎဏတထဒဓနပဖဗဘမယရလဝသဟဠအဣဤဥဦဧဨဩဪါာိီုူေဲဳဴဵံ့း္်ျြွှဿ၀၁၂၃၄၅၆၇၈၉၊။၌၍၎၏ၐၑၓၚၛၜၝၞၟၠ–—‘’‚“”•…−",
3
+ "img_height": 160,
4
  "img_width": 1024,
5
+ "model_version": "3.5",
6
+ "architecture": "MobileNetV3-Large + SE + BiLSTM + BottleneckAttention + CTC",
7
+ "num_classes": 277,
8
+ "rnn_hidden_size": 512,
 
9
  "rnn_layers": 2,
10
  "backbone": "mobilenetv3_large",
11
  "input_normalization": "pixel / 127.5 - 1.0",
12
  "input_dtype": "float32",
13
  "input_channels": 1,
14
  "input_colorspace": "grayscale",
15
+ "format": "pytorch"
16
+ }
onnx/charset.txt CHANGED
@@ -1 +1 @@
1
- !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~£¥¦§©«¬°±²³´µ·¸¹º»¾ÀÁÂÄÅÆÇÉÊÌÍÑÓÖרÜÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüþĀāıŒœŠšŽžƒːμπကခဂဃငစဆဇဈဉညဋဌဍဎဏတထဒဓနပဖဗဘမယရလဝသဟဠအဢဣဤဥဦဧဨဩဪါာိီုူေဲဳဴဵံ့း္်ျြွှဿ၀၁၂၃၄၅၆၇၈၉၊။၌၍၎၏ၐၑၓၚၛၜၝၞၟၠၡၢၣၤၥၨၪၰၱၲၳၴၵၷၸၹၺၻၼၾၿႀႄႅႆႇႈႉႊႏ႐႒႓႔႕႘႙ႜႝ႟–‘’‚“”•…−
 
1
+ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~£¥¦§©«¬°±²³´µ·¸¹º»¼½¾ÀÁÂÄÅÆÇÉÊÌÍÑÓÖרÜÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüþĀāıŒœŠšŽžƒːπကခဂဃငစဆဇဈဉညဋဌဍဎဏတထဒဓနပဖဗဘမယရလဝသဟဠအဣဤဥဦဧဨဩဪါာိီုူေဲဳဴဵံ့း္်ျြွှဿ၀၁၂၃၄၅၆၇၈၉၊။၌၍၎၏ၐၑၓၚၛၜၝၞၟၠ–—‘’‚“”•…−
onnx/monocr.json CHANGED
@@ -1,18 +1,16 @@
1
  {
2
- "charset": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~£¥¦§©«¬°±²³´µ·¸¹º»¾ÀÁÂÄÅÆÇÉÊÌÍÑÓÖרÜÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüþĀāıŒœŠšŽžƒːμπကခဂဃငစဆဇဈဉညဋဌဍဎဏတထဒဓနပဖဗဘမယရလဝသဟဠအဢဣဤဥဦဧဨဩဪါာိီုူေဲဳဴဵံ့း္်ျြွှဿ၀၁၂၃၄၅၆၇၈၉၊။၌၍၎၏ၐၑၓၚၛၜၝၞၟၠၡၢၣၤၥၨၪၰၱၲၳၴၵၷၸၹၺၻၼၾၿႀႄႅႆႇႈႉႊႏ႐႒႓႔႕႘႙ႜႝ႟–‘’‚“”•…−",
3
- "img_height": 128,
4
  "img_width": 1024,
5
  "opset_version": 17,
6
- "model_version": "2.0",
7
- "format": "onnx",
8
- "architecture": "MobileNetV3-Large + BiLSTM(384) + CTC",
9
- "num_classes": 316,
10
- "rnn_hidden_size": 384,
11
  "rnn_layers": 2,
12
  "backbone": "mobilenetv3_large",
13
  "input_normalization": "pixel / 127.5 - 1.0",
14
  "input_dtype": "float32",
15
  "input_channels": 1,
16
- "input_colorspace": "grayscale",
17
- "_provenance": "Charset repaired 2026-08-14. This sidecar declared a 912-character corpus-scanned charset against a 316-class model, so 150 of the 315 decodable indices mapped to the wrong character and any consumer decoded Mon as Latin/IPA text with no error and no lookup miss. The charset here is the 315-character allowlist read from charset.txt in this repository (git blob 08b1c23299dd1f68f14b7bdb4be586dd52d27c5d); it is byte-identical to the repaired sidecar in mon_OCR data/models/archive-v2-2026-03/, which was confirmed by decoding validation samples against their labels. num_classes is recorded here so this class of mismatch is checkable: CTC reserves index 0 for blank, so num_classes must equal len(charset) + 1. It is confirmed by fc.weight (316, 768) and hyper_parameters['num_classes'] in the published monocr.ckpt. The 912-character string arrived in commit df456df, a Core ML export that overwrote both this file and the root monocr.json with the Core ML variant -- which is also why the ONNX sidecar had lost opset_version and declared format 'mlpackage'. A re-export that writes only one sidecar will reintroduce that. model_version stays '2.0': mon_OCR names this artifact '2.0-legacy' internally, but that string is a judgement relative to unpublished v3.5 code and changing a published contract field could break an exact-match check in the four SDKs the model card lists. The v2 graph takes [1, 1, 128, width] float32 grayscale: batch is fixed at 1 and the width axis is dynamic. img_width 1024 is the width training preprocessing pads to, not a graph constraint -- README.md states both and reads as a contradiction. opset_version 17 is read from the v2 fp32, fp16 and int8 ONNX exports, the fp32 of which is byte-identical to the ONNX published here at commit d29385b; the binary currently published (LFS oid f212ab7e) is a later re-export that has not been re-inspected."
18
  }
 
1
  {
2
+ "charset": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~£¥¦§©«¬°±²³´µ·¸¹º»¼½¾ÀÁÂÄÅÆÇÉÊÌÍÑÓÖרÜÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüþĀāıŒœŠšŽžƒːπကခဂဃငစဆဇဈဉညဋဌဍဎဏတထဒဓနပဖဗဘမယရလဝသဟဠအဣဤဥဦဧဨဩဪါာိီုူေဲဳဴဵံ့း္်ျြွှဿ၀၁၂၃၄၅၆၇၈၉၊။၌၍၎၏ၐၑၓၚၛၜၝၞၟၠ–—‘’‚“”•…−",
3
+ "img_height": 160,
4
  "img_width": 1024,
5
  "opset_version": 17,
6
+ "model_version": "3.5",
7
+ "architecture": "MobileNetV3-Large + SE + BiLSTM + BottleneckAttention + CTC",
8
+ "num_classes": 277,
9
+ "rnn_hidden_size": 512,
 
10
  "rnn_layers": 2,
11
  "backbone": "mobilenetv3_large",
12
  "input_normalization": "pixel / 127.5 - 1.0",
13
  "input_dtype": "float32",
14
  "input_channels": 1,
15
+ "input_colorspace": "grayscale"
 
16
  }
onnx/monocr.onnx CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f212ab7e76c4dc7f120e600fe60ce3bd99227efa7e5ba402f446daa04b6271db
3
- size 26355440
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b95de1ea0e3dc99a5c31bea32e220835da801f683ed17091eaec9954c80a4c04
3
+ size 46247040
pytorch/monocr.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c779f69016ca87da570a474d4f38f8c6110502540485d428f8f90d6d8e03d44e
3
+ size 46348409