asterocr 1.0.1__tar.gz → 1.0.2__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.
- {asterocr-1.0.1 → asterocr-1.0.2}/PKG-INFO +1 -3
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/__init__.py +1 -1
- asterocr-1.0.2/asterocr/assets/asternet.onnx +4 -0
- asterocr-1.0.2/asterocr/assets/vocab.json +232 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/pipeline.py +18 -13
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr.egg-info/PKG-INFO +1 -3
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr.egg-info/SOURCES.txt +2 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr.egg-info/requires.txt +0 -1
- {asterocr-1.0.1 → asterocr-1.0.2}/pyproject.toml +5 -3
- {asterocr-1.0.1 → asterocr-1.0.2}/README.md +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/cli.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/comparator.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/dataset/export_real_zip.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/dataset/loader.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/dataset/unified_packer.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/download_dataset.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/inference/decoder.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/inference/lexicon.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/inference/predictor.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/inference/viet_linguistics.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/kaggle_bridge/__init__.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/kaggle_bridge/chunker.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/kaggle_bridge/colab_auto_runner.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/kaggle_bridge/kaggle_worker.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/kaggle_bridge/launcher.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/kaggle_bridge/tunnel.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/models/backbone.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/models/language.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/models/model.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/models/sequence.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/studio.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/synthesizer/corpus.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/synthesizer/font_manager.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/synthesizer/generator.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/synthesizer/handwriting_generator.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/synthesizer/mega_generator.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/trainer/metrics.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/trainer/trainer.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr/vocab.py +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr.egg-info/dependency_links.txt +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr.egg-info/entry_points.txt +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/asterocr.egg-info/top_level.txt +0 -0
- {asterocr-1.0.1 → asterocr-1.0.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: asterocr
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: AsterOCR: High-Performance Non-Autoregressive Vietnamese Optical Character Recognition Engine
|
|
5
5
|
Author-email: asterxlabs <contact@asterxlabs.com>
|
|
6
6
|
License: MIT
|
|
@@ -14,7 +14,6 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.10
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
18
17
|
Classifier: Operating System :: OS Independent
|
|
19
18
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
19
|
Classifier: Topic :: Scientific/Engineering :: Image Recognition
|
|
@@ -23,7 +22,6 @@ Description-Content-Type: text/markdown
|
|
|
23
22
|
Requires-Dist: numpy>=1.20.0
|
|
24
23
|
Requires-Dist: Pillow>=8.0.0
|
|
25
24
|
Requires-Dist: onnxruntime>=1.14.0
|
|
26
|
-
Requires-Dist: huggingface_hub>=0.19.0
|
|
27
25
|
Provides-Extra: torch
|
|
28
26
|
Requires-Dist: torch>=2.0.0; extra == "torch"
|
|
29
27
|
Provides-Extra: all
|
|
@@ -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.
|
|
7
|
+
__version__ = "1.0.2"
|
|
8
8
|
|
|
9
9
|
from asterocr.pipeline import AsterOCR
|
|
10
10
|
from asterocr.vocab import default_vocab
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
{
|
|
2
|
+
"chars": [
|
|
3
|
+
"<blank>",
|
|
4
|
+
"a",
|
|
5
|
+
"à",
|
|
6
|
+
"á",
|
|
7
|
+
"ả",
|
|
8
|
+
"ã",
|
|
9
|
+
"ạ",
|
|
10
|
+
"ă",
|
|
11
|
+
"ằ",
|
|
12
|
+
"ắ",
|
|
13
|
+
"ẳ",
|
|
14
|
+
"ẵ",
|
|
15
|
+
"ặ",
|
|
16
|
+
"â",
|
|
17
|
+
"ầ",
|
|
18
|
+
"ấ",
|
|
19
|
+
"ẩ",
|
|
20
|
+
"ẫ",
|
|
21
|
+
"ậ",
|
|
22
|
+
"b",
|
|
23
|
+
"c",
|
|
24
|
+
"d",
|
|
25
|
+
"đ",
|
|
26
|
+
"e",
|
|
27
|
+
"è",
|
|
28
|
+
"é",
|
|
29
|
+
"ẻ",
|
|
30
|
+
"ẽ",
|
|
31
|
+
"ẹ",
|
|
32
|
+
"ê",
|
|
33
|
+
"ề",
|
|
34
|
+
"ế",
|
|
35
|
+
"ể",
|
|
36
|
+
"ễ",
|
|
37
|
+
"ệ",
|
|
38
|
+
"f",
|
|
39
|
+
"g",
|
|
40
|
+
"h",
|
|
41
|
+
"i",
|
|
42
|
+
"ì",
|
|
43
|
+
"í",
|
|
44
|
+
"ỉ",
|
|
45
|
+
"ĩ",
|
|
46
|
+
"ị",
|
|
47
|
+
"j",
|
|
48
|
+
"k",
|
|
49
|
+
"l",
|
|
50
|
+
"m",
|
|
51
|
+
"n",
|
|
52
|
+
"o",
|
|
53
|
+
"ò",
|
|
54
|
+
"ó",
|
|
55
|
+
"ỏ",
|
|
56
|
+
"õ",
|
|
57
|
+
"ọ",
|
|
58
|
+
"ô",
|
|
59
|
+
"ồ",
|
|
60
|
+
"ố",
|
|
61
|
+
"ổ",
|
|
62
|
+
"ỗ",
|
|
63
|
+
"ộ",
|
|
64
|
+
"ơ",
|
|
65
|
+
"ờ",
|
|
66
|
+
"ớ",
|
|
67
|
+
"ở",
|
|
68
|
+
"ỡ",
|
|
69
|
+
"ợ",
|
|
70
|
+
"p",
|
|
71
|
+
"q",
|
|
72
|
+
"r",
|
|
73
|
+
"s",
|
|
74
|
+
"t",
|
|
75
|
+
"u",
|
|
76
|
+
"ù",
|
|
77
|
+
"ú",
|
|
78
|
+
"ủ",
|
|
79
|
+
"ũ",
|
|
80
|
+
"ụ",
|
|
81
|
+
"ư",
|
|
82
|
+
"ừ",
|
|
83
|
+
"ứ",
|
|
84
|
+
"ử",
|
|
85
|
+
"ữ",
|
|
86
|
+
"ự",
|
|
87
|
+
"v",
|
|
88
|
+
"w",
|
|
89
|
+
"x",
|
|
90
|
+
"y",
|
|
91
|
+
"ỳ",
|
|
92
|
+
"ý",
|
|
93
|
+
"ỷ",
|
|
94
|
+
"ỹ",
|
|
95
|
+
"ỵ",
|
|
96
|
+
"z",
|
|
97
|
+
"A",
|
|
98
|
+
"À",
|
|
99
|
+
"Á",
|
|
100
|
+
"Ả",
|
|
101
|
+
"Ã",
|
|
102
|
+
"Ạ",
|
|
103
|
+
"Ă",
|
|
104
|
+
"Ằ",
|
|
105
|
+
"Ắ",
|
|
106
|
+
"Ẳ",
|
|
107
|
+
"Ẵ",
|
|
108
|
+
"Ặ",
|
|
109
|
+
"Â",
|
|
110
|
+
"Ầ",
|
|
111
|
+
"Ấ",
|
|
112
|
+
"Ẩ",
|
|
113
|
+
"Ẫ",
|
|
114
|
+
"Ậ",
|
|
115
|
+
"B",
|
|
116
|
+
"C",
|
|
117
|
+
"D",
|
|
118
|
+
"Đ",
|
|
119
|
+
"E",
|
|
120
|
+
"È",
|
|
121
|
+
"É",
|
|
122
|
+
"Ẻ",
|
|
123
|
+
"Ẽ",
|
|
124
|
+
"Ẹ",
|
|
125
|
+
"Ê",
|
|
126
|
+
"Ề",
|
|
127
|
+
"Ế",
|
|
128
|
+
"Ể",
|
|
129
|
+
"Ễ",
|
|
130
|
+
"Ệ",
|
|
131
|
+
"F",
|
|
132
|
+
"G",
|
|
133
|
+
"H",
|
|
134
|
+
"I",
|
|
135
|
+
"Ì",
|
|
136
|
+
"Í",
|
|
137
|
+
"Ỉ",
|
|
138
|
+
"Ĩ",
|
|
139
|
+
"Ị",
|
|
140
|
+
"J",
|
|
141
|
+
"K",
|
|
142
|
+
"L",
|
|
143
|
+
"M",
|
|
144
|
+
"N",
|
|
145
|
+
"O",
|
|
146
|
+
"Ò",
|
|
147
|
+
"Ó",
|
|
148
|
+
"Ỏ",
|
|
149
|
+
"Õ",
|
|
150
|
+
"Ọ",
|
|
151
|
+
"Ô",
|
|
152
|
+
"Ồ",
|
|
153
|
+
"Ố",
|
|
154
|
+
"Ổ",
|
|
155
|
+
"Ỗ",
|
|
156
|
+
"Ộ",
|
|
157
|
+
"Ơ",
|
|
158
|
+
"Ờ",
|
|
159
|
+
"Ớ",
|
|
160
|
+
"Ở",
|
|
161
|
+
"Ỡ",
|
|
162
|
+
"Ợ",
|
|
163
|
+
"P",
|
|
164
|
+
"Q",
|
|
165
|
+
"R",
|
|
166
|
+
"S",
|
|
167
|
+
"T",
|
|
168
|
+
"U",
|
|
169
|
+
"Ù",
|
|
170
|
+
"Ú",
|
|
171
|
+
"Ủ",
|
|
172
|
+
"Ũ",
|
|
173
|
+
"Ụ",
|
|
174
|
+
"Ư",
|
|
175
|
+
"Ừ",
|
|
176
|
+
"Ứ",
|
|
177
|
+
"Ử",
|
|
178
|
+
"Ữ",
|
|
179
|
+
"Ự",
|
|
180
|
+
"V",
|
|
181
|
+
"W",
|
|
182
|
+
"X",
|
|
183
|
+
"Y",
|
|
184
|
+
"Ỳ",
|
|
185
|
+
"Ý",
|
|
186
|
+
"Ỷ",
|
|
187
|
+
"Ỹ",
|
|
188
|
+
"Ỵ",
|
|
189
|
+
"Z",
|
|
190
|
+
"0",
|
|
191
|
+
"1",
|
|
192
|
+
"2",
|
|
193
|
+
"3",
|
|
194
|
+
"4",
|
|
195
|
+
"5",
|
|
196
|
+
"6",
|
|
197
|
+
"7",
|
|
198
|
+
"8",
|
|
199
|
+
"9",
|
|
200
|
+
" ",
|
|
201
|
+
",",
|
|
202
|
+
".",
|
|
203
|
+
"-",
|
|
204
|
+
":",
|
|
205
|
+
";",
|
|
206
|
+
"\"",
|
|
207
|
+
"'",
|
|
208
|
+
"?",
|
|
209
|
+
"!",
|
|
210
|
+
"(",
|
|
211
|
+
")",
|
|
212
|
+
"[",
|
|
213
|
+
"]",
|
|
214
|
+
"{",
|
|
215
|
+
"}",
|
|
216
|
+
"/",
|
|
217
|
+
"%",
|
|
218
|
+
"+",
|
|
219
|
+
"$",
|
|
220
|
+
"&",
|
|
221
|
+
"=",
|
|
222
|
+
"*",
|
|
223
|
+
"#",
|
|
224
|
+
"@",
|
|
225
|
+
"_",
|
|
226
|
+
"\\",
|
|
227
|
+
"<",
|
|
228
|
+
">",
|
|
229
|
+
"°"
|
|
230
|
+
],
|
|
231
|
+
"size": 227
|
|
232
|
+
}
|
|
@@ -50,7 +50,12 @@ class AsterOCR:
|
|
|
50
50
|
|
|
51
51
|
filename = "asternet.onnx" if self.backend == "onnx" else "asternet_best.pth"
|
|
52
52
|
|
|
53
|
-
# 1.
|
|
53
|
+
# 1. Embedded package assets (100% offline and standalone)
|
|
54
|
+
bundled_asset = os.path.join(os.path.dirname(__file__), "assets", filename)
|
|
55
|
+
if os.path.exists(bundled_asset):
|
|
56
|
+
return bundled_asset
|
|
57
|
+
|
|
58
|
+
# 2. Local workspace candidates
|
|
54
59
|
candidates = [
|
|
55
60
|
os.path.join("models", filename),
|
|
56
61
|
os.path.join("hf_model", filename),
|
|
@@ -61,18 +66,18 @@ class AsterOCR:
|
|
|
61
66
|
if os.path.exists(c):
|
|
62
67
|
return c
|
|
63
68
|
|
|
64
|
-
#
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
# 3. Optional remote fetch fallback
|
|
70
|
+
if hf_hub_download is not None:
|
|
71
|
+
os.makedirs(CACHE_DIR, exist_ok=True)
|
|
72
|
+
print(f"[*] Đang tải mô hình AsterOCR ({filename}) từ {DEFAULT_HF_REPO}...")
|
|
73
|
+
cached_file = hf_hub_download(
|
|
74
|
+
repo_id=DEFAULT_HF_REPO,
|
|
75
|
+
filename=filename,
|
|
76
|
+
cache_dir=CACHE_DIR
|
|
77
|
+
)
|
|
78
|
+
return cached_file
|
|
79
|
+
|
|
80
|
+
raise FileNotFoundError(f"Không tìm thấy file mô hình '{filename}' trong package hoặc thư mục cục bộ.")
|
|
76
81
|
return cached_file
|
|
77
82
|
|
|
78
83
|
def _init_onnx(self):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: asterocr
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: AsterOCR: High-Performance Non-Autoregressive Vietnamese Optical Character Recognition Engine
|
|
5
5
|
Author-email: asterxlabs <contact@asterxlabs.com>
|
|
6
6
|
License: MIT
|
|
@@ -14,7 +14,6 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.10
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
18
17
|
Classifier: Operating System :: OS Independent
|
|
19
18
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
19
|
Classifier: Topic :: Scientific/Engineering :: Image Recognition
|
|
@@ -23,7 +22,6 @@ Description-Content-Type: text/markdown
|
|
|
23
22
|
Requires-Dist: numpy>=1.20.0
|
|
24
23
|
Requires-Dist: Pillow>=8.0.0
|
|
25
24
|
Requires-Dist: onnxruntime>=1.14.0
|
|
26
|
-
Requires-Dist: huggingface_hub>=0.19.0
|
|
27
25
|
Provides-Extra: torch
|
|
28
26
|
Requires-Dist: torch>=2.0.0; extra == "torch"
|
|
29
27
|
Provides-Extra: all
|
|
@@ -13,6 +13,8 @@ asterocr.egg-info/dependency_links.txt
|
|
|
13
13
|
asterocr.egg-info/entry_points.txt
|
|
14
14
|
asterocr.egg-info/requires.txt
|
|
15
15
|
asterocr.egg-info/top_level.txt
|
|
16
|
+
asterocr/assets/asternet.onnx
|
|
17
|
+
asterocr/assets/vocab.json
|
|
16
18
|
asterocr/dataset/export_real_zip.py
|
|
17
19
|
asterocr/dataset/loader.py
|
|
18
20
|
asterocr/dataset/unified_packer.py
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "asterocr"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.2"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name="asterxlabs", email="contact@asterxlabs.com" },
|
|
10
10
|
]
|
|
@@ -20,7 +20,6 @@ classifiers = [
|
|
|
20
20
|
"Programming Language :: Python :: 3.10",
|
|
21
21
|
"Programming Language :: Python :: 3.11",
|
|
22
22
|
"Programming Language :: Python :: 3.12",
|
|
23
|
-
"License :: OSI Approved :: MIT License",
|
|
24
23
|
"Operating System :: OS Independent",
|
|
25
24
|
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
26
25
|
"Topic :: Scientific/Engineering :: Image Recognition",
|
|
@@ -29,7 +28,6 @@ dependencies = [
|
|
|
29
28
|
"numpy>=1.20.0",
|
|
30
29
|
"Pillow>=8.0.0",
|
|
31
30
|
"onnxruntime>=1.14.0",
|
|
32
|
-
"huggingface_hub>=0.19.0",
|
|
33
31
|
]
|
|
34
32
|
|
|
35
33
|
[project.optional-dependencies]
|
|
@@ -52,3 +50,7 @@ asterocr = "asterocr.cli:main"
|
|
|
52
50
|
[tool.setuptools.packages.find]
|
|
53
51
|
include = ["asterocr*"]
|
|
54
52
|
exclude = ["scratch*", "tests*", "samples*", "dataset*"]
|
|
53
|
+
|
|
54
|
+
[tool.setuptools.package-data]
|
|
55
|
+
asterocr = ["assets/*"]
|
|
56
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|