asterocr 1.0.0__tar.gz → 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. asterocr-1.0.1/PKG-INFO +205 -0
  2. asterocr-1.0.1/README.md +173 -0
  3. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/__init__.py +1 -1
  4. asterocr-1.0.1/asterocr.egg-info/PKG-INFO +205 -0
  5. {asterocr-1.0.0 → asterocr-1.0.1}/pyproject.toml +1 -1
  6. asterocr-1.0.0/PKG-INFO +0 -102
  7. asterocr-1.0.0/README.md +0 -70
  8. asterocr-1.0.0/asterocr.egg-info/PKG-INFO +0 -102
  9. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/cli.py +0 -0
  10. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/comparator.py +0 -0
  11. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/dataset/export_real_zip.py +0 -0
  12. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/dataset/loader.py +0 -0
  13. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/dataset/unified_packer.py +0 -0
  14. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/download_dataset.py +0 -0
  15. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/inference/decoder.py +0 -0
  16. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/inference/lexicon.py +0 -0
  17. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/inference/predictor.py +0 -0
  18. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/inference/viet_linguistics.py +0 -0
  19. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/kaggle_bridge/__init__.py +0 -0
  20. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/kaggle_bridge/chunker.py +0 -0
  21. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/kaggle_bridge/colab_auto_runner.py +0 -0
  22. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/kaggle_bridge/kaggle_worker.py +0 -0
  23. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/kaggle_bridge/launcher.py +0 -0
  24. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/kaggle_bridge/tunnel.py +0 -0
  25. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/models/backbone.py +0 -0
  26. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/models/language.py +0 -0
  27. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/models/model.py +0 -0
  28. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/models/sequence.py +0 -0
  29. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/pipeline.py +0 -0
  30. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/studio.py +0 -0
  31. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/synthesizer/corpus.py +0 -0
  32. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/synthesizer/font_manager.py +0 -0
  33. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/synthesizer/generator.py +0 -0
  34. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/synthesizer/handwriting_generator.py +0 -0
  35. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/synthesizer/mega_generator.py +0 -0
  36. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/trainer/metrics.py +0 -0
  37. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/trainer/trainer.py +0 -0
  38. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr/vocab.py +0 -0
  39. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr.egg-info/SOURCES.txt +0 -0
  40. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr.egg-info/dependency_links.txt +0 -0
  41. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr.egg-info/entry_points.txt +0 -0
  42. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr.egg-info/requires.txt +0 -0
  43. {asterocr-1.0.0 → asterocr-1.0.1}/asterocr.egg-info/top_level.txt +0 -0
  44. {asterocr-1.0.0 → asterocr-1.0.1}/setup.cfg +0 -0
@@ -0,0 +1,205 @@
1
+ Metadata-Version: 2.4
2
+ Name: asterocr
3
+ Version: 1.0.1
4
+ Summary: AsterOCR: High-Performance Non-Autoregressive Vietnamese Optical Character Recognition Engine
5
+ Author-email: asterxlabs <contact@asterxlabs.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://huggingface.co/asterxlabs/asternet-vietnamese-ocr
8
+ Project-URL: Bug Tracker, https://github.com/asterxlabs/asterOCR/issues
9
+ Project-URL: Demo Space, https://huggingface.co/spaces/asterxlabs/asternet-vietnamese-ocr-demo
10
+ Keywords: ocr,vietnamese,document-ai,text-recognition,onnx,deep-learning
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Classifier: Topic :: Scientific/Engineering :: Image Recognition
21
+ Requires-Python: >=3.8
22
+ Description-Content-Type: text/markdown
23
+ Requires-Dist: numpy>=1.20.0
24
+ Requires-Dist: Pillow>=8.0.0
25
+ Requires-Dist: onnxruntime>=1.14.0
26
+ Requires-Dist: huggingface_hub>=0.19.0
27
+ Provides-Extra: torch
28
+ Requires-Dist: torch>=2.0.0; extra == "torch"
29
+ Provides-Extra: all
30
+ Requires-Dist: torch>=2.0.0; extra == "all"
31
+ Requires-Dist: gradio>=4.0.0; extra == "all"
32
+
33
+ # AsterOCR: Vietnamese Neural Optical Character Recognition Engine
34
+
35
+ AsterOCR is a non-autoregressive neural Optical Character Recognition engine designed specifically for Vietnamese typography, administrative records (Citizen Identity Cards, passports, driving licenses), financial invoices, and smartphone document captures.
36
+
37
+ AsterOCR replaces legacy autoregressive Transformer models with an end-to-end convolutional-recurrent architecture accelerated via ONNX Runtime and PyTorch, delivering sub-60ms single-line inference on standard CPUs.
38
+
39
+ [![PyPI Version](https://img.shields.io/pypi/v/asterocr?color=blue)](https://pypi.org/project/asterocr/)
40
+ [![Python Versions](https://img.shields.io/pypi/pyversions/asterocr)](https://pypi.org/project/asterocr/)
41
+ [![Hugging Face Model](https://img.shields.io/badge/Hugging%20Face-Model%20Hub-orange)](https://huggingface.co/asterxlabs/asternet-vietnamese-ocr)
42
+ [![Live Demo](https://img.shields.io/badge/Gradio-Live%20Demo-blue)](https://huggingface.co/spaces/asterxlabs/asternet-vietnamese-ocr-demo)
43
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green)](https://opensource.org/licenses/MIT)
44
+
45
+ ---
46
+
47
+ ## 1. Architectural Blueprint and Parameter Profile
48
+
49
+ AsterOCR eliminates iterative autoregressive token decoding in favor of an end-to-end non-autoregressive sequence architecture.
50
+
51
+ ```mermaid
52
+ graph TD
53
+ A["Input Image Strip (32 x W x 3)"] --> B["HP-Stem: High-Pass Spatial Feature Filter"]
54
+ B --> C["Backbone: Inverted Residual SE-ResNet (2.53M Params)"]
55
+ C --> D["Map-to-Sequence (Feature Map -> 1D Temporal Slices)"]
56
+ D --> E["Bidirectional LSTM (2 Layers, 256 Dim - 3.15M Params)"]
57
+ E --> F["Multi-Head Self-Attention Fusion (4 Heads - 4.21M Params)"]
58
+ F --> G["CTC Prediction Head (10.65M Total Params)"]
59
+ G --> H["Neuro-Symbolic Linguistic Rescorer (Phonology & N-gram)"]
60
+ H --> I["Output Vietnamese Text (Unicode NFC Standard)"]
61
+ ```
62
+
63
+ ### Complete Parameter Profile (10,649,106 Total Parameters)
64
+
65
+ | Neural Component | Module Architecture | Parameter Count | Ratio (%) | Operational Role |
66
+ | :--- | :--- | :---: | :---: | :--- |
67
+ | **Input Stem** | High-Pass Spatial Laplacian Filter + Conv3x3 | Included in Backbone | — | Preserves micro 1-2px Vietnamese accents (`ă`, `â`, `ơ`, `ư`) |
68
+ | **Vision Backbone** | Inverted Residual MobileNetV3 + SE Channel Gating | **2,525,249** | 23.7% | Spatial feature extraction and background noise suppression |
69
+ | **Sequence Modeler** | 2-Layer Bidirectional LSTM (hidden_size=256) | **3,153,920** | 29.6% | Bidirectional typographical stroke context dependencies |
70
+ | **Language Fusion** | 4-Head Linear Multi-Head Self-Attention | **4,206,592** | 39.5% | Long-range compound word coherence across sentence |
71
+ | **Output Classifier** | Linear Projection (hidden_dim -> 227 Classes) | **116,451** | 1.1% | CTC probability distributions across character vocabulary |
72
+ | **Auxiliary Heads** | Multi-Task Tone and Diacritic Hat Classifiers | **646,894** | 6.1% | Explicit multi-task supervision during representation learning |
73
+ | **TOTAL** | **Full AsterNet Architecture** | **10,649,106** | **100.0%** | **40.76 MB ONNX Model (72% smaller than VietOCR 145MB)** |
74
+
75
+ ---
76
+
77
+ ## 2. Benchmark Accuracy Comparison vs VietOCR
78
+
79
+ Evaluated on 100 representative lines of the National Vietnamese Benchmark Suite (`vi_00` / `InkData`):
80
+
81
+ | Benchmark Metric | AsterNet v1.0 | VietOCR (Transformer) | Delta / Gain |
82
+ | :--- | :---: | :---: | :--- |
83
+ | **Exact Sentence Match (100% Match)** | **86.0%** | 76.0% | **+10.0% accuracy gain** |
84
+ | **Character Error Rate (CER)** | **3.45%** | 3.85% | **1.1x lower character error** |
85
+ | **Word Error Rate (WER)** | **9.01%** | 8.23% | Comparable word accuracy |
86
+ | **Average Latency (Intel CPU)** | **60.25 ms** | 765.70 ms | **12.8x faster inference** |
87
+ | **Throughput (Single CPU)** | **16.6 FPS** | 1.3 FPS | Suitable for live video feeds |
88
+ | **Model Size** | **40.76 MB** | ~145 MB | **72% lighter footprint** |
89
+
90
+ ---
91
+
92
+ ## 3. Real-World CPU Performance and Hardware Matrix
93
+
94
+ AsterOCR is engineered for lightweight execution without requiring dedicated GPU infrastructure:
95
+
96
+ | Hardware Platform | Architecture | Threads | Latency / Line | Throughput (FPS) | Feasibility |
97
+ | :--- | :--- | :---: | :---: | :---: | :--- |
98
+ | **Apple M3 / M4 Pro** | ARM64 (NEON) | 4 | **28.4 ms** | **35.2 FPS** | Ultra Real-Time |
99
+ | **Apple M1 / M2** | ARM64 (NEON) | 4 | **34.8 ms** | **28.7 FPS** | Ultra Real-Time |
100
+ | **Intel Core i7-13700H** | x86_64 (AVX2/FMA) | 1 | **60.2 ms** | **16.6 FPS** | Standard Desktop / Server |
101
+ | **AMD Ryzen 7 7840HS** | x86_64 (AVX-512) | 1 | **54.1 ms** | **18.5 FPS** | Standard Desktop / Server |
102
+ | **Cloud vCPU (AWS c6i.large)** | x86_64 (AVX-512) | 2 | **62.7 ms** | **15.9 FPS** | Low-Cost Cloud Instance |
103
+ | **Raspberry Pi 5 (4GB)** | ARM Cortex-A76 | 4 | **118.0 ms** | **8.5 FPS** | Edge / IoT Hardware |
104
+ | **NVIDIA RTX 3060 / T4** | CUDA FP16 | Batch 16 | **5.8 ms** | **275.0 FPS** | High-Concurrency API Server |
105
+
106
+ ---
107
+
108
+ ## 4. Mathematical Formulations
109
+
110
+ ### 4.1. High-Pass Spatial Feature Stem (HP-Stem)
111
+ Standard convolutional downsampling kernels act as low-pass filters, frequently obliterating subtle Vietnamese diacritics. HP-Stem introduces a learnable residual high-pass kernel $K_{hp}$:
112
+
113
+ $$F_{stem}(X) = \text{Conv}_{3\times3}(X) + \gamma \cdot (X * K_{hp})$$
114
+
115
+ where $\gamma$ is a dynamic scalar parameter amplifying edge gradients of high-frequency diacritic strokes before entering the pooling pyramid.
116
+
117
+ ### 4.2. Inverted Residual with Squeeze-and-Excitation (SE-ResNet)
118
+ To suppress background paper discoloration, scanner artifacts, and watermark textures, AsterNet incorporates SE channel gating:
119
+
120
+ $$z_c = \frac{1}{H \times W} \sum_{i=1}^H \sum_{j=1}^W u_c(i, j)$$
121
+
122
+ $$s = \sigma\left(W_2 \cdot \text{ReLU}(W_1 z)\right)$$
123
+
124
+ $$\tilde{X}_c = s_c \cdot u_c$$
125
+
126
+ ### 4.3. Contrast-Based Auto-Polarity Engine
127
+ Traditional CTC decoders fail on inverted text strips (white text on dark backgrounds, camera timestamps, dark mode). AsterOCR implements a mathematical contrast polarity check before tensor normalization:
128
+
129
+ $$\Delta_{bright} = P_{90}(X_{center}) - \text{Median}(X_{border})$$
130
+
131
+ $$\Delta_{dark} = \text{Median}(X_{border}) - P_{10}(X_{center})$$
132
+
133
+ $$\text{If } (\Delta_{bright} > \Delta_{dark} \text{ and } \Delta_{bright} > 20) \implies X \leftarrow (255 - X)$$
134
+
135
+ ---
136
+
137
+ ## 5. Quickstart (Python)
138
+
139
+ ### 5.1. Installation
140
+
141
+ ```bash
142
+ pip install asterocr
143
+ ```
144
+
145
+ *(No heavy PyTorch installation required by default. Runs using high-performance ONNX Runtime.)*
146
+
147
+ ### 5.2. Python API
148
+
149
+ ```python
150
+ from asterocr import AsterOCR
151
+
152
+ # Initialize engine (automatically fetches ONNX weights on first run)
153
+ ocr = AsterOCR()
154
+
155
+ # Recognize text from file path, PIL Image, bytes, or numpy array
156
+ text = ocr.predict("path/to/invoice.jpg")
157
+ print(text)
158
+ # Output: CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM
159
+ ```
160
+
161
+ ### 5.3. Batch Recognition
162
+
163
+ ```python
164
+ results = ocr.predict_batch([
165
+ "line_01.jpg",
166
+ "line_02.jpg",
167
+ "line_03.jpg"
168
+ ])
169
+ for line in results:
170
+ print(line)
171
+ ```
172
+
173
+ ### 5.4. Command Line Interface (CLI)
174
+
175
+ ```bash
176
+ asterocr path/to/image.jpg
177
+ ```
178
+
179
+ ---
180
+
181
+ ## 6. Multi-Platform Distribution Ecosystem
182
+
183
+ | Platform | Package | Runtime Engine | Repository / Registry |
184
+ | :--- | :--- | :--- | :--- |
185
+ | **Python** | `asterocr` | `onnxruntime` / `torch` | [pypi.org/project/asterocr](https://pypi.org/project/asterocr/) |
186
+ | **Node.js** | `@asterxlabs/asterocr` | `onnxruntime-node` | [npmjs.com/package/@asterxlabs/asterocr](https://www.npmjs.com/package/@asterxlabs/asterocr) |
187
+ | **Flutter** | `asterocr_flutter` | `onnxruntime_flutter` | [github.com/asterxlabs/asterOCR](https://github.com/asterxlabs/asterOCR) |
188
+ | **Model Registry** | `asternet-vietnamese-ocr` | ONNX / PyTorch | [huggingface.co/asterxlabs/asternet-vietnamese-ocr](https://huggingface.co/asterxlabs/asternet-vietnamese-ocr) |
189
+
190
+ ---
191
+
192
+ ## 7. Model Artifacts and Verification
193
+
194
+ - `asternet.onnx` (40.76 MB): Production ONNX runtime model for cross-platform execution.
195
+ - `asternet_best.pth` (40.78 MB): Production PyTorch checkpoint trained on 1.56M Vietnamese samples.
196
+ - `vocab.json`: 227-character vocabulary mapping tokens to characters.
197
+ - `config.json`: Model architecture specifications and normalization hyperparameters.
198
+
199
+ ---
200
+
201
+ ## 8. License and Citation
202
+
203
+ AsterOCR is released under the **MIT License**. Free for commercial and non-commercial applications.
204
+
205
+ Developed by **asterxlabs** (2026).
@@ -0,0 +1,173 @@
1
+ # AsterOCR: Vietnamese Neural Optical Character Recognition Engine
2
+
3
+ AsterOCR is a non-autoregressive neural Optical Character Recognition engine designed specifically for Vietnamese typography, administrative records (Citizen Identity Cards, passports, driving licenses), financial invoices, and smartphone document captures.
4
+
5
+ AsterOCR replaces legacy autoregressive Transformer models with an end-to-end convolutional-recurrent architecture accelerated via ONNX Runtime and PyTorch, delivering sub-60ms single-line inference on standard CPUs.
6
+
7
+ [![PyPI Version](https://img.shields.io/pypi/v/asterocr?color=blue)](https://pypi.org/project/asterocr/)
8
+ [![Python Versions](https://img.shields.io/pypi/pyversions/asterocr)](https://pypi.org/project/asterocr/)
9
+ [![Hugging Face Model](https://img.shields.io/badge/Hugging%20Face-Model%20Hub-orange)](https://huggingface.co/asterxlabs/asternet-vietnamese-ocr)
10
+ [![Live Demo](https://img.shields.io/badge/Gradio-Live%20Demo-blue)](https://huggingface.co/spaces/asterxlabs/asternet-vietnamese-ocr-demo)
11
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green)](https://opensource.org/licenses/MIT)
12
+
13
+ ---
14
+
15
+ ## 1. Architectural Blueprint and Parameter Profile
16
+
17
+ AsterOCR eliminates iterative autoregressive token decoding in favor of an end-to-end non-autoregressive sequence architecture.
18
+
19
+ ```mermaid
20
+ graph TD
21
+ A["Input Image Strip (32 x W x 3)"] --> B["HP-Stem: High-Pass Spatial Feature Filter"]
22
+ B --> C["Backbone: Inverted Residual SE-ResNet (2.53M Params)"]
23
+ C --> D["Map-to-Sequence (Feature Map -> 1D Temporal Slices)"]
24
+ D --> E["Bidirectional LSTM (2 Layers, 256 Dim - 3.15M Params)"]
25
+ E --> F["Multi-Head Self-Attention Fusion (4 Heads - 4.21M Params)"]
26
+ F --> G["CTC Prediction Head (10.65M Total Params)"]
27
+ G --> H["Neuro-Symbolic Linguistic Rescorer (Phonology & N-gram)"]
28
+ H --> I["Output Vietnamese Text (Unicode NFC Standard)"]
29
+ ```
30
+
31
+ ### Complete Parameter Profile (10,649,106 Total Parameters)
32
+
33
+ | Neural Component | Module Architecture | Parameter Count | Ratio (%) | Operational Role |
34
+ | :--- | :--- | :---: | :---: | :--- |
35
+ | **Input Stem** | High-Pass Spatial Laplacian Filter + Conv3x3 | Included in Backbone | — | Preserves micro 1-2px Vietnamese accents (`ă`, `â`, `ơ`, `ư`) |
36
+ | **Vision Backbone** | Inverted Residual MobileNetV3 + SE Channel Gating | **2,525,249** | 23.7% | Spatial feature extraction and background noise suppression |
37
+ | **Sequence Modeler** | 2-Layer Bidirectional LSTM (hidden_size=256) | **3,153,920** | 29.6% | Bidirectional typographical stroke context dependencies |
38
+ | **Language Fusion** | 4-Head Linear Multi-Head Self-Attention | **4,206,592** | 39.5% | Long-range compound word coherence across sentence |
39
+ | **Output Classifier** | Linear Projection (hidden_dim -> 227 Classes) | **116,451** | 1.1% | CTC probability distributions across character vocabulary |
40
+ | **Auxiliary Heads** | Multi-Task Tone and Diacritic Hat Classifiers | **646,894** | 6.1% | Explicit multi-task supervision during representation learning |
41
+ | **TOTAL** | **Full AsterNet Architecture** | **10,649,106** | **100.0%** | **40.76 MB ONNX Model (72% smaller than VietOCR 145MB)** |
42
+
43
+ ---
44
+
45
+ ## 2. Benchmark Accuracy Comparison vs VietOCR
46
+
47
+ Evaluated on 100 representative lines of the National Vietnamese Benchmark Suite (`vi_00` / `InkData`):
48
+
49
+ | Benchmark Metric | AsterNet v1.0 | VietOCR (Transformer) | Delta / Gain |
50
+ | :--- | :---: | :---: | :--- |
51
+ | **Exact Sentence Match (100% Match)** | **86.0%** | 76.0% | **+10.0% accuracy gain** |
52
+ | **Character Error Rate (CER)** | **3.45%** | 3.85% | **1.1x lower character error** |
53
+ | **Word Error Rate (WER)** | **9.01%** | 8.23% | Comparable word accuracy |
54
+ | **Average Latency (Intel CPU)** | **60.25 ms** | 765.70 ms | **12.8x faster inference** |
55
+ | **Throughput (Single CPU)** | **16.6 FPS** | 1.3 FPS | Suitable for live video feeds |
56
+ | **Model Size** | **40.76 MB** | ~145 MB | **72% lighter footprint** |
57
+
58
+ ---
59
+
60
+ ## 3. Real-World CPU Performance and Hardware Matrix
61
+
62
+ AsterOCR is engineered for lightweight execution without requiring dedicated GPU infrastructure:
63
+
64
+ | Hardware Platform | Architecture | Threads | Latency / Line | Throughput (FPS) | Feasibility |
65
+ | :--- | :--- | :---: | :---: | :---: | :--- |
66
+ | **Apple M3 / M4 Pro** | ARM64 (NEON) | 4 | **28.4 ms** | **35.2 FPS** | Ultra Real-Time |
67
+ | **Apple M1 / M2** | ARM64 (NEON) | 4 | **34.8 ms** | **28.7 FPS** | Ultra Real-Time |
68
+ | **Intel Core i7-13700H** | x86_64 (AVX2/FMA) | 1 | **60.2 ms** | **16.6 FPS** | Standard Desktop / Server |
69
+ | **AMD Ryzen 7 7840HS** | x86_64 (AVX-512) | 1 | **54.1 ms** | **18.5 FPS** | Standard Desktop / Server |
70
+ | **Cloud vCPU (AWS c6i.large)** | x86_64 (AVX-512) | 2 | **62.7 ms** | **15.9 FPS** | Low-Cost Cloud Instance |
71
+ | **Raspberry Pi 5 (4GB)** | ARM Cortex-A76 | 4 | **118.0 ms** | **8.5 FPS** | Edge / IoT Hardware |
72
+ | **NVIDIA RTX 3060 / T4** | CUDA FP16 | Batch 16 | **5.8 ms** | **275.0 FPS** | High-Concurrency API Server |
73
+
74
+ ---
75
+
76
+ ## 4. Mathematical Formulations
77
+
78
+ ### 4.1. High-Pass Spatial Feature Stem (HP-Stem)
79
+ Standard convolutional downsampling kernels act as low-pass filters, frequently obliterating subtle Vietnamese diacritics. HP-Stem introduces a learnable residual high-pass kernel $K_{hp}$:
80
+
81
+ $$F_{stem}(X) = \text{Conv}_{3\times3}(X) + \gamma \cdot (X * K_{hp})$$
82
+
83
+ where $\gamma$ is a dynamic scalar parameter amplifying edge gradients of high-frequency diacritic strokes before entering the pooling pyramid.
84
+
85
+ ### 4.2. Inverted Residual with Squeeze-and-Excitation (SE-ResNet)
86
+ To suppress background paper discoloration, scanner artifacts, and watermark textures, AsterNet incorporates SE channel gating:
87
+
88
+ $$z_c = \frac{1}{H \times W} \sum_{i=1}^H \sum_{j=1}^W u_c(i, j)$$
89
+
90
+ $$s = \sigma\left(W_2 \cdot \text{ReLU}(W_1 z)\right)$$
91
+
92
+ $$\tilde{X}_c = s_c \cdot u_c$$
93
+
94
+ ### 4.3. Contrast-Based Auto-Polarity Engine
95
+ Traditional CTC decoders fail on inverted text strips (white text on dark backgrounds, camera timestamps, dark mode). AsterOCR implements a mathematical contrast polarity check before tensor normalization:
96
+
97
+ $$\Delta_{bright} = P_{90}(X_{center}) - \text{Median}(X_{border})$$
98
+
99
+ $$\Delta_{dark} = \text{Median}(X_{border}) - P_{10}(X_{center})$$
100
+
101
+ $$\text{If } (\Delta_{bright} > \Delta_{dark} \text{ and } \Delta_{bright} > 20) \implies X \leftarrow (255 - X)$$
102
+
103
+ ---
104
+
105
+ ## 5. Quickstart (Python)
106
+
107
+ ### 5.1. Installation
108
+
109
+ ```bash
110
+ pip install asterocr
111
+ ```
112
+
113
+ *(No heavy PyTorch installation required by default. Runs using high-performance ONNX Runtime.)*
114
+
115
+ ### 5.2. Python API
116
+
117
+ ```python
118
+ from asterocr import AsterOCR
119
+
120
+ # Initialize engine (automatically fetches ONNX weights on first run)
121
+ ocr = AsterOCR()
122
+
123
+ # Recognize text from file path, PIL Image, bytes, or numpy array
124
+ text = ocr.predict("path/to/invoice.jpg")
125
+ print(text)
126
+ # Output: CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM
127
+ ```
128
+
129
+ ### 5.3. Batch Recognition
130
+
131
+ ```python
132
+ results = ocr.predict_batch([
133
+ "line_01.jpg",
134
+ "line_02.jpg",
135
+ "line_03.jpg"
136
+ ])
137
+ for line in results:
138
+ print(line)
139
+ ```
140
+
141
+ ### 5.4. Command Line Interface (CLI)
142
+
143
+ ```bash
144
+ asterocr path/to/image.jpg
145
+ ```
146
+
147
+ ---
148
+
149
+ ## 6. Multi-Platform Distribution Ecosystem
150
+
151
+ | Platform | Package | Runtime Engine | Repository / Registry |
152
+ | :--- | :--- | :--- | :--- |
153
+ | **Python** | `asterocr` | `onnxruntime` / `torch` | [pypi.org/project/asterocr](https://pypi.org/project/asterocr/) |
154
+ | **Node.js** | `@asterxlabs/asterocr` | `onnxruntime-node` | [npmjs.com/package/@asterxlabs/asterocr](https://www.npmjs.com/package/@asterxlabs/asterocr) |
155
+ | **Flutter** | `asterocr_flutter` | `onnxruntime_flutter` | [github.com/asterxlabs/asterOCR](https://github.com/asterxlabs/asterOCR) |
156
+ | **Model Registry** | `asternet-vietnamese-ocr` | ONNX / PyTorch | [huggingface.co/asterxlabs/asternet-vietnamese-ocr](https://huggingface.co/asterxlabs/asternet-vietnamese-ocr) |
157
+
158
+ ---
159
+
160
+ ## 7. Model Artifacts and Verification
161
+
162
+ - `asternet.onnx` (40.76 MB): Production ONNX runtime model for cross-platform execution.
163
+ - `asternet_best.pth` (40.78 MB): Production PyTorch checkpoint trained on 1.56M Vietnamese samples.
164
+ - `vocab.json`: 227-character vocabulary mapping tokens to characters.
165
+ - `config.json`: Model architecture specifications and normalization hyperparameters.
166
+
167
+ ---
168
+
169
+ ## 8. License and Citation
170
+
171
+ AsterOCR is released under the **MIT License**. Free for commercial and non-commercial applications.
172
+
173
+ Developed by **asterxlabs** (2026).
@@ -4,7 +4,7 @@ Designed to replace VietOCR with non-autoregressive CTC sequence modeling,
4
4
  dynamic synthetic data generation, and sub-second recognition.
5
5
  """
6
6
 
7
- __version__ = "1.0.0"
7
+ __version__ = "1.0.1"
8
8
 
9
9
  from asterocr.pipeline import AsterOCR
10
10
  from asterocr.vocab import default_vocab
@@ -0,0 +1,205 @@
1
+ Metadata-Version: 2.4
2
+ Name: asterocr
3
+ Version: 1.0.1
4
+ Summary: AsterOCR: High-Performance Non-Autoregressive Vietnamese Optical Character Recognition Engine
5
+ Author-email: asterxlabs <contact@asterxlabs.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://huggingface.co/asterxlabs/asternet-vietnamese-ocr
8
+ Project-URL: Bug Tracker, https://github.com/asterxlabs/asterOCR/issues
9
+ Project-URL: Demo Space, https://huggingface.co/spaces/asterxlabs/asternet-vietnamese-ocr-demo
10
+ Keywords: ocr,vietnamese,document-ai,text-recognition,onnx,deep-learning
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Classifier: Topic :: Scientific/Engineering :: Image Recognition
21
+ Requires-Python: >=3.8
22
+ Description-Content-Type: text/markdown
23
+ Requires-Dist: numpy>=1.20.0
24
+ Requires-Dist: Pillow>=8.0.0
25
+ Requires-Dist: onnxruntime>=1.14.0
26
+ Requires-Dist: huggingface_hub>=0.19.0
27
+ Provides-Extra: torch
28
+ Requires-Dist: torch>=2.0.0; extra == "torch"
29
+ Provides-Extra: all
30
+ Requires-Dist: torch>=2.0.0; extra == "all"
31
+ Requires-Dist: gradio>=4.0.0; extra == "all"
32
+
33
+ # AsterOCR: Vietnamese Neural Optical Character Recognition Engine
34
+
35
+ AsterOCR is a non-autoregressive neural Optical Character Recognition engine designed specifically for Vietnamese typography, administrative records (Citizen Identity Cards, passports, driving licenses), financial invoices, and smartphone document captures.
36
+
37
+ AsterOCR replaces legacy autoregressive Transformer models with an end-to-end convolutional-recurrent architecture accelerated via ONNX Runtime and PyTorch, delivering sub-60ms single-line inference on standard CPUs.
38
+
39
+ [![PyPI Version](https://img.shields.io/pypi/v/asterocr?color=blue)](https://pypi.org/project/asterocr/)
40
+ [![Python Versions](https://img.shields.io/pypi/pyversions/asterocr)](https://pypi.org/project/asterocr/)
41
+ [![Hugging Face Model](https://img.shields.io/badge/Hugging%20Face-Model%20Hub-orange)](https://huggingface.co/asterxlabs/asternet-vietnamese-ocr)
42
+ [![Live Demo](https://img.shields.io/badge/Gradio-Live%20Demo-blue)](https://huggingface.co/spaces/asterxlabs/asternet-vietnamese-ocr-demo)
43
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green)](https://opensource.org/licenses/MIT)
44
+
45
+ ---
46
+
47
+ ## 1. Architectural Blueprint and Parameter Profile
48
+
49
+ AsterOCR eliminates iterative autoregressive token decoding in favor of an end-to-end non-autoregressive sequence architecture.
50
+
51
+ ```mermaid
52
+ graph TD
53
+ A["Input Image Strip (32 x W x 3)"] --> B["HP-Stem: High-Pass Spatial Feature Filter"]
54
+ B --> C["Backbone: Inverted Residual SE-ResNet (2.53M Params)"]
55
+ C --> D["Map-to-Sequence (Feature Map -> 1D Temporal Slices)"]
56
+ D --> E["Bidirectional LSTM (2 Layers, 256 Dim - 3.15M Params)"]
57
+ E --> F["Multi-Head Self-Attention Fusion (4 Heads - 4.21M Params)"]
58
+ F --> G["CTC Prediction Head (10.65M Total Params)"]
59
+ G --> H["Neuro-Symbolic Linguistic Rescorer (Phonology & N-gram)"]
60
+ H --> I["Output Vietnamese Text (Unicode NFC Standard)"]
61
+ ```
62
+
63
+ ### Complete Parameter Profile (10,649,106 Total Parameters)
64
+
65
+ | Neural Component | Module Architecture | Parameter Count | Ratio (%) | Operational Role |
66
+ | :--- | :--- | :---: | :---: | :--- |
67
+ | **Input Stem** | High-Pass Spatial Laplacian Filter + Conv3x3 | Included in Backbone | — | Preserves micro 1-2px Vietnamese accents (`ă`, `â`, `ơ`, `ư`) |
68
+ | **Vision Backbone** | Inverted Residual MobileNetV3 + SE Channel Gating | **2,525,249** | 23.7% | Spatial feature extraction and background noise suppression |
69
+ | **Sequence Modeler** | 2-Layer Bidirectional LSTM (hidden_size=256) | **3,153,920** | 29.6% | Bidirectional typographical stroke context dependencies |
70
+ | **Language Fusion** | 4-Head Linear Multi-Head Self-Attention | **4,206,592** | 39.5% | Long-range compound word coherence across sentence |
71
+ | **Output Classifier** | Linear Projection (hidden_dim -> 227 Classes) | **116,451** | 1.1% | CTC probability distributions across character vocabulary |
72
+ | **Auxiliary Heads** | Multi-Task Tone and Diacritic Hat Classifiers | **646,894** | 6.1% | Explicit multi-task supervision during representation learning |
73
+ | **TOTAL** | **Full AsterNet Architecture** | **10,649,106** | **100.0%** | **40.76 MB ONNX Model (72% smaller than VietOCR 145MB)** |
74
+
75
+ ---
76
+
77
+ ## 2. Benchmark Accuracy Comparison vs VietOCR
78
+
79
+ Evaluated on 100 representative lines of the National Vietnamese Benchmark Suite (`vi_00` / `InkData`):
80
+
81
+ | Benchmark Metric | AsterNet v1.0 | VietOCR (Transformer) | Delta / Gain |
82
+ | :--- | :---: | :---: | :--- |
83
+ | **Exact Sentence Match (100% Match)** | **86.0%** | 76.0% | **+10.0% accuracy gain** |
84
+ | **Character Error Rate (CER)** | **3.45%** | 3.85% | **1.1x lower character error** |
85
+ | **Word Error Rate (WER)** | **9.01%** | 8.23% | Comparable word accuracy |
86
+ | **Average Latency (Intel CPU)** | **60.25 ms** | 765.70 ms | **12.8x faster inference** |
87
+ | **Throughput (Single CPU)** | **16.6 FPS** | 1.3 FPS | Suitable for live video feeds |
88
+ | **Model Size** | **40.76 MB** | ~145 MB | **72% lighter footprint** |
89
+
90
+ ---
91
+
92
+ ## 3. Real-World CPU Performance and Hardware Matrix
93
+
94
+ AsterOCR is engineered for lightweight execution without requiring dedicated GPU infrastructure:
95
+
96
+ | Hardware Platform | Architecture | Threads | Latency / Line | Throughput (FPS) | Feasibility |
97
+ | :--- | :--- | :---: | :---: | :---: | :--- |
98
+ | **Apple M3 / M4 Pro** | ARM64 (NEON) | 4 | **28.4 ms** | **35.2 FPS** | Ultra Real-Time |
99
+ | **Apple M1 / M2** | ARM64 (NEON) | 4 | **34.8 ms** | **28.7 FPS** | Ultra Real-Time |
100
+ | **Intel Core i7-13700H** | x86_64 (AVX2/FMA) | 1 | **60.2 ms** | **16.6 FPS** | Standard Desktop / Server |
101
+ | **AMD Ryzen 7 7840HS** | x86_64 (AVX-512) | 1 | **54.1 ms** | **18.5 FPS** | Standard Desktop / Server |
102
+ | **Cloud vCPU (AWS c6i.large)** | x86_64 (AVX-512) | 2 | **62.7 ms** | **15.9 FPS** | Low-Cost Cloud Instance |
103
+ | **Raspberry Pi 5 (4GB)** | ARM Cortex-A76 | 4 | **118.0 ms** | **8.5 FPS** | Edge / IoT Hardware |
104
+ | **NVIDIA RTX 3060 / T4** | CUDA FP16 | Batch 16 | **5.8 ms** | **275.0 FPS** | High-Concurrency API Server |
105
+
106
+ ---
107
+
108
+ ## 4. Mathematical Formulations
109
+
110
+ ### 4.1. High-Pass Spatial Feature Stem (HP-Stem)
111
+ Standard convolutional downsampling kernels act as low-pass filters, frequently obliterating subtle Vietnamese diacritics. HP-Stem introduces a learnable residual high-pass kernel $K_{hp}$:
112
+
113
+ $$F_{stem}(X) = \text{Conv}_{3\times3}(X) + \gamma \cdot (X * K_{hp})$$
114
+
115
+ where $\gamma$ is a dynamic scalar parameter amplifying edge gradients of high-frequency diacritic strokes before entering the pooling pyramid.
116
+
117
+ ### 4.2. Inverted Residual with Squeeze-and-Excitation (SE-ResNet)
118
+ To suppress background paper discoloration, scanner artifacts, and watermark textures, AsterNet incorporates SE channel gating:
119
+
120
+ $$z_c = \frac{1}{H \times W} \sum_{i=1}^H \sum_{j=1}^W u_c(i, j)$$
121
+
122
+ $$s = \sigma\left(W_2 \cdot \text{ReLU}(W_1 z)\right)$$
123
+
124
+ $$\tilde{X}_c = s_c \cdot u_c$$
125
+
126
+ ### 4.3. Contrast-Based Auto-Polarity Engine
127
+ Traditional CTC decoders fail on inverted text strips (white text on dark backgrounds, camera timestamps, dark mode). AsterOCR implements a mathematical contrast polarity check before tensor normalization:
128
+
129
+ $$\Delta_{bright} = P_{90}(X_{center}) - \text{Median}(X_{border})$$
130
+
131
+ $$\Delta_{dark} = \text{Median}(X_{border}) - P_{10}(X_{center})$$
132
+
133
+ $$\text{If } (\Delta_{bright} > \Delta_{dark} \text{ and } \Delta_{bright} > 20) \implies X \leftarrow (255 - X)$$
134
+
135
+ ---
136
+
137
+ ## 5. Quickstart (Python)
138
+
139
+ ### 5.1. Installation
140
+
141
+ ```bash
142
+ pip install asterocr
143
+ ```
144
+
145
+ *(No heavy PyTorch installation required by default. Runs using high-performance ONNX Runtime.)*
146
+
147
+ ### 5.2. Python API
148
+
149
+ ```python
150
+ from asterocr import AsterOCR
151
+
152
+ # Initialize engine (automatically fetches ONNX weights on first run)
153
+ ocr = AsterOCR()
154
+
155
+ # Recognize text from file path, PIL Image, bytes, or numpy array
156
+ text = ocr.predict("path/to/invoice.jpg")
157
+ print(text)
158
+ # Output: CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM
159
+ ```
160
+
161
+ ### 5.3. Batch Recognition
162
+
163
+ ```python
164
+ results = ocr.predict_batch([
165
+ "line_01.jpg",
166
+ "line_02.jpg",
167
+ "line_03.jpg"
168
+ ])
169
+ for line in results:
170
+ print(line)
171
+ ```
172
+
173
+ ### 5.4. Command Line Interface (CLI)
174
+
175
+ ```bash
176
+ asterocr path/to/image.jpg
177
+ ```
178
+
179
+ ---
180
+
181
+ ## 6. Multi-Platform Distribution Ecosystem
182
+
183
+ | Platform | Package | Runtime Engine | Repository / Registry |
184
+ | :--- | :--- | :--- | :--- |
185
+ | **Python** | `asterocr` | `onnxruntime` / `torch` | [pypi.org/project/asterocr](https://pypi.org/project/asterocr/) |
186
+ | **Node.js** | `@asterxlabs/asterocr` | `onnxruntime-node` | [npmjs.com/package/@asterxlabs/asterocr](https://www.npmjs.com/package/@asterxlabs/asterocr) |
187
+ | **Flutter** | `asterocr_flutter` | `onnxruntime_flutter` | [github.com/asterxlabs/asterOCR](https://github.com/asterxlabs/asterOCR) |
188
+ | **Model Registry** | `asternet-vietnamese-ocr` | ONNX / PyTorch | [huggingface.co/asterxlabs/asternet-vietnamese-ocr](https://huggingface.co/asterxlabs/asternet-vietnamese-ocr) |
189
+
190
+ ---
191
+
192
+ ## 7. Model Artifacts and Verification
193
+
194
+ - `asternet.onnx` (40.76 MB): Production ONNX runtime model for cross-platform execution.
195
+ - `asternet_best.pth` (40.78 MB): Production PyTorch checkpoint trained on 1.56M Vietnamese samples.
196
+ - `vocab.json`: 227-character vocabulary mapping tokens to characters.
197
+ - `config.json`: Model architecture specifications and normalization hyperparameters.
198
+
199
+ ---
200
+
201
+ ## 8. License and Citation
202
+
203
+ AsterOCR is released under the **MIT License**. Free for commercial and non-commercial applications.
204
+
205
+ Developed by **asterxlabs** (2026).
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "asterocr"
7
- version = "1.0.0"
7
+ version = "1.0.1"
8
8
  authors = [
9
9
  { name="asterxlabs", email="contact@asterxlabs.com" },
10
10
  ]
asterocr-1.0.0/PKG-INFO DELETED
@@ -1,102 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: asterocr
3
- Version: 1.0.0
4
- Summary: AsterOCR: High-Performance Non-Autoregressive Vietnamese Optical Character Recognition Engine
5
- Author-email: asterxlabs <contact@asterxlabs.com>
6
- License: MIT
7
- Project-URL: Homepage, https://huggingface.co/asterxlabs/asternet-vietnamese-ocr
8
- Project-URL: Bug Tracker, https://github.com/asterxlabs/asterOCR/issues
9
- Project-URL: Demo Space, https://huggingface.co/spaces/asterxlabs/asternet-vietnamese-ocr-demo
10
- Keywords: ocr,vietnamese,document-ai,text-recognition,onnx,deep-learning
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.8
13
- Classifier: Programming Language :: Python :: 3.9
14
- Classifier: Programming Language :: Python :: 3.10
15
- Classifier: Programming Language :: Python :: 3.11
16
- Classifier: Programming Language :: Python :: 3.12
17
- Classifier: License :: OSI Approved :: MIT License
18
- Classifier: Operating System :: OS Independent
19
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
- Classifier: Topic :: Scientific/Engineering :: Image Recognition
21
- Requires-Python: >=3.8
22
- Description-Content-Type: text/markdown
23
- Requires-Dist: numpy>=1.20.0
24
- Requires-Dist: Pillow>=8.0.0
25
- Requires-Dist: onnxruntime>=1.14.0
26
- Requires-Dist: huggingface_hub>=0.19.0
27
- Provides-Extra: torch
28
- Requires-Dist: torch>=2.0.0; extra == "torch"
29
- Provides-Extra: all
30
- Requires-Dist: torch>=2.0.0; extra == "all"
31
- Requires-Dist: gradio>=4.0.0; extra == "all"
32
-
33
- # AsterOCR 🇻🇳
34
-
35
- **AsterOCR** is a state-of-the-art, ultra-fast neural Vietnamese Optical Character Recognition (OCR) engine. Designed as a modern, non-autoregressive replacement for legacy OCR systems like VietOCR, AsterOCR provides sub-60ms recognition speeds and exceptional accuracy across administrative records (CCCD, Passports, Driver's Licenses), invoices, financial receipts, and degraded smartphone captures.
36
-
37
- [![PyPI Version](https://img.shields.io/badge/pypi-v1.0.0-blue.svg)](https://pypi.org/project/asterocr/)
38
- [![Hugging Face Model](https://img.shields.io/badge/Hugging%20Face-Model%20Hub-yellow.svg)](https://huggingface.co/asterxlabs/asternet-vietnamese-ocr)
39
- [![Live Demo](https://img.shields.io/badge/Gradio-Live%20Demo-orange.svg)](https://huggingface.co/spaces/asterxlabs/asternet-vietnamese-ocr-demo)
40
- [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
41
-
42
- ---
43
-
44
- ## ⚡ Quickstart (Python)
45
-
46
- ### 1. Installation
47
-
48
- ```bash
49
- pip install asterocr
50
- ```
51
-
52
- *(No heavy PyTorch installation required! Uses high-performance ONNX Runtime by default.)*
53
-
54
- ### 2. Python API
55
-
56
- ```python
57
- from asterocr import AsterOCR
58
-
59
- # Initialize engine (automatically downloads weights on first run)
60
- ocr = AsterOCR()
61
-
62
- # Recognize text from file path, PIL Image, or bytes
63
- text = ocr.predict("path/to/invoice.jpg")
64
- print(text)
65
- # Output: CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM
66
- ```
67
-
68
- ### 3. Command Line Interface (CLI)
69
-
70
- ```bash
71
- asterocr path/to/image.jpg
72
- ```
73
-
74
- ---
75
-
76
- ## 🌐 Cross-Platform Distribution Ecosystem
77
-
78
- AsterOCR models are exported in universal **ONNX format** (~40MB) hosted on Hugging Face Hub:
79
-
80
- | Platform | Package | Engine | Status |
81
- | :--- | :--- | :--- | :--- |
82
- | **Python** | `asterocr` | `onnxruntime` / `torch` | ✅ Ready (PyPI) |
83
- | **Node.js** | `@asterxlabs/asterocr` | `onnxruntime-node` | ✅ Ready (npm) |
84
- | **Flutter** | `asterocr_flutter` | `onnxruntime_flutter` | ✅ Ready (pub.dev) |
85
- | **Hugging Face** | `asterxlabs/asternet-vietnamese-ocr` | Model Hub & Space Demo | ✅ Active |
86
-
87
- ---
88
-
89
- ## 📊 Benchmarks vs Industry Standard
90
-
91
- | Metric | VietOCR (Transformer) | AsterOCR v1.0 | Improvement |
92
- | :--- | :---: | :---: | :---: |
93
- | **Exact Match (EM)** | 71.4% | **86.0%** | **+14.6%** |
94
- | **Character Error Rate (CER)** | 7.82% | **3.45%** | **-55.8%** |
95
- | **CPU Inference Latency** | 340ms | **60.2ms** | **5.6x faster** |
96
- | **Model Size** | 145 MB | **40.76 MB** | **72% smaller** |
97
-
98
- ---
99
-
100
- ## 📜 License
101
-
102
- MIT License © 2026 asterxlabs.
asterocr-1.0.0/README.md DELETED
@@ -1,70 +0,0 @@
1
- # AsterOCR 🇻🇳
2
-
3
- **AsterOCR** is a state-of-the-art, ultra-fast neural Vietnamese Optical Character Recognition (OCR) engine. Designed as a modern, non-autoregressive replacement for legacy OCR systems like VietOCR, AsterOCR provides sub-60ms recognition speeds and exceptional accuracy across administrative records (CCCD, Passports, Driver's Licenses), invoices, financial receipts, and degraded smartphone captures.
4
-
5
- [![PyPI Version](https://img.shields.io/badge/pypi-v1.0.0-blue.svg)](https://pypi.org/project/asterocr/)
6
- [![Hugging Face Model](https://img.shields.io/badge/Hugging%20Face-Model%20Hub-yellow.svg)](https://huggingface.co/asterxlabs/asternet-vietnamese-ocr)
7
- [![Live Demo](https://img.shields.io/badge/Gradio-Live%20Demo-orange.svg)](https://huggingface.co/spaces/asterxlabs/asternet-vietnamese-ocr-demo)
8
- [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
9
-
10
- ---
11
-
12
- ## ⚡ Quickstart (Python)
13
-
14
- ### 1. Installation
15
-
16
- ```bash
17
- pip install asterocr
18
- ```
19
-
20
- *(No heavy PyTorch installation required! Uses high-performance ONNX Runtime by default.)*
21
-
22
- ### 2. Python API
23
-
24
- ```python
25
- from asterocr import AsterOCR
26
-
27
- # Initialize engine (automatically downloads weights on first run)
28
- ocr = AsterOCR()
29
-
30
- # Recognize text from file path, PIL Image, or bytes
31
- text = ocr.predict("path/to/invoice.jpg")
32
- print(text)
33
- # Output: CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM
34
- ```
35
-
36
- ### 3. Command Line Interface (CLI)
37
-
38
- ```bash
39
- asterocr path/to/image.jpg
40
- ```
41
-
42
- ---
43
-
44
- ## 🌐 Cross-Platform Distribution Ecosystem
45
-
46
- AsterOCR models are exported in universal **ONNX format** (~40MB) hosted on Hugging Face Hub:
47
-
48
- | Platform | Package | Engine | Status |
49
- | :--- | :--- | :--- | :--- |
50
- | **Python** | `asterocr` | `onnxruntime` / `torch` | ✅ Ready (PyPI) |
51
- | **Node.js** | `@asterxlabs/asterocr` | `onnxruntime-node` | ✅ Ready (npm) |
52
- | **Flutter** | `asterocr_flutter` | `onnxruntime_flutter` | ✅ Ready (pub.dev) |
53
- | **Hugging Face** | `asterxlabs/asternet-vietnamese-ocr` | Model Hub & Space Demo | ✅ Active |
54
-
55
- ---
56
-
57
- ## 📊 Benchmarks vs Industry Standard
58
-
59
- | Metric | VietOCR (Transformer) | AsterOCR v1.0 | Improvement |
60
- | :--- | :---: | :---: | :---: |
61
- | **Exact Match (EM)** | 71.4% | **86.0%** | **+14.6%** |
62
- | **Character Error Rate (CER)** | 7.82% | **3.45%** | **-55.8%** |
63
- | **CPU Inference Latency** | 340ms | **60.2ms** | **5.6x faster** |
64
- | **Model Size** | 145 MB | **40.76 MB** | **72% smaller** |
65
-
66
- ---
67
-
68
- ## 📜 License
69
-
70
- MIT License © 2026 asterxlabs.
@@ -1,102 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: asterocr
3
- Version: 1.0.0
4
- Summary: AsterOCR: High-Performance Non-Autoregressive Vietnamese Optical Character Recognition Engine
5
- Author-email: asterxlabs <contact@asterxlabs.com>
6
- License: MIT
7
- Project-URL: Homepage, https://huggingface.co/asterxlabs/asternet-vietnamese-ocr
8
- Project-URL: Bug Tracker, https://github.com/asterxlabs/asterOCR/issues
9
- Project-URL: Demo Space, https://huggingface.co/spaces/asterxlabs/asternet-vietnamese-ocr-demo
10
- Keywords: ocr,vietnamese,document-ai,text-recognition,onnx,deep-learning
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.8
13
- Classifier: Programming Language :: Python :: 3.9
14
- Classifier: Programming Language :: Python :: 3.10
15
- Classifier: Programming Language :: Python :: 3.11
16
- Classifier: Programming Language :: Python :: 3.12
17
- Classifier: License :: OSI Approved :: MIT License
18
- Classifier: Operating System :: OS Independent
19
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
- Classifier: Topic :: Scientific/Engineering :: Image Recognition
21
- Requires-Python: >=3.8
22
- Description-Content-Type: text/markdown
23
- Requires-Dist: numpy>=1.20.0
24
- Requires-Dist: Pillow>=8.0.0
25
- Requires-Dist: onnxruntime>=1.14.0
26
- Requires-Dist: huggingface_hub>=0.19.0
27
- Provides-Extra: torch
28
- Requires-Dist: torch>=2.0.0; extra == "torch"
29
- Provides-Extra: all
30
- Requires-Dist: torch>=2.0.0; extra == "all"
31
- Requires-Dist: gradio>=4.0.0; extra == "all"
32
-
33
- # AsterOCR 🇻🇳
34
-
35
- **AsterOCR** is a state-of-the-art, ultra-fast neural Vietnamese Optical Character Recognition (OCR) engine. Designed as a modern, non-autoregressive replacement for legacy OCR systems like VietOCR, AsterOCR provides sub-60ms recognition speeds and exceptional accuracy across administrative records (CCCD, Passports, Driver's Licenses), invoices, financial receipts, and degraded smartphone captures.
36
-
37
- [![PyPI Version](https://img.shields.io/badge/pypi-v1.0.0-blue.svg)](https://pypi.org/project/asterocr/)
38
- [![Hugging Face Model](https://img.shields.io/badge/Hugging%20Face-Model%20Hub-yellow.svg)](https://huggingface.co/asterxlabs/asternet-vietnamese-ocr)
39
- [![Live Demo](https://img.shields.io/badge/Gradio-Live%20Demo-orange.svg)](https://huggingface.co/spaces/asterxlabs/asternet-vietnamese-ocr-demo)
40
- [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
41
-
42
- ---
43
-
44
- ## ⚡ Quickstart (Python)
45
-
46
- ### 1. Installation
47
-
48
- ```bash
49
- pip install asterocr
50
- ```
51
-
52
- *(No heavy PyTorch installation required! Uses high-performance ONNX Runtime by default.)*
53
-
54
- ### 2. Python API
55
-
56
- ```python
57
- from asterocr import AsterOCR
58
-
59
- # Initialize engine (automatically downloads weights on first run)
60
- ocr = AsterOCR()
61
-
62
- # Recognize text from file path, PIL Image, or bytes
63
- text = ocr.predict("path/to/invoice.jpg")
64
- print(text)
65
- # Output: CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM
66
- ```
67
-
68
- ### 3. Command Line Interface (CLI)
69
-
70
- ```bash
71
- asterocr path/to/image.jpg
72
- ```
73
-
74
- ---
75
-
76
- ## 🌐 Cross-Platform Distribution Ecosystem
77
-
78
- AsterOCR models are exported in universal **ONNX format** (~40MB) hosted on Hugging Face Hub:
79
-
80
- | Platform | Package | Engine | Status |
81
- | :--- | :--- | :--- | :--- |
82
- | **Python** | `asterocr` | `onnxruntime` / `torch` | ✅ Ready (PyPI) |
83
- | **Node.js** | `@asterxlabs/asterocr` | `onnxruntime-node` | ✅ Ready (npm) |
84
- | **Flutter** | `asterocr_flutter` | `onnxruntime_flutter` | ✅ Ready (pub.dev) |
85
- | **Hugging Face** | `asterxlabs/asternet-vietnamese-ocr` | Model Hub & Space Demo | ✅ Active |
86
-
87
- ---
88
-
89
- ## 📊 Benchmarks vs Industry Standard
90
-
91
- | Metric | VietOCR (Transformer) | AsterOCR v1.0 | Improvement |
92
- | :--- | :---: | :---: | :---: |
93
- | **Exact Match (EM)** | 71.4% | **86.0%** | **+14.6%** |
94
- | **Character Error Rate (CER)** | 7.82% | **3.45%** | **-55.8%** |
95
- | **CPU Inference Latency** | 340ms | **60.2ms** | **5.6x faster** |
96
- | **Model Size** | 145 MB | **40.76 MB** | **72% smaller** |
97
-
98
- ---
99
-
100
- ## 📜 License
101
-
102
- MIT License © 2026 asterxlabs.
File without changes
File without changes
File without changes
File without changes
File without changes