onnxtr 0.7.1__tar.gz → 0.8.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.
- {onnxtr-0.7.1 → onnxtr-0.8.1}/PKG-INFO +35 -6
- {onnxtr-0.7.1 → onnxtr-0.8.1}/README.md +30 -3
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/contrib/artefacts.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/contrib/base.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/file_utils.py +1 -2
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/io/elements.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/io/html.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/io/image.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/io/pdf.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/io/reader.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/_utils.py +55 -17
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/builder.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/classification/models/mobilenet.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/classification/predictor/base.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/classification/zoo.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/detection/_utils/base.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/detection/core.py +2 -2
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/detection/models/differentiable_binarization.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/detection/models/fast.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/detection/models/linknet.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/detection/postprocessor/base.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/detection/predictor/base.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/detection/zoo.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/engine.py +22 -6
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/factory/hub.py +18 -13
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/predictor/base.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/predictor/predictor.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/preprocessor/base.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/recognition/core.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/recognition/models/crnn.py +4 -4
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/recognition/models/master.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/recognition/models/parseq.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/recognition/models/sar.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/recognition/models/viptr.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/recognition/models/vitstr.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/recognition/predictor/_utils.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/recognition/predictor/base.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/recognition/utils.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/recognition/zoo.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/zoo.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/transforms/base.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/utils/common_types.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/utils/data.py +1 -2
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/utils/fonts.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/utils/geometry.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/utils/multithreading.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/utils/reconstitution.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/utils/repr.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/utils/visualization.py +1 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/utils/vocabs.py +1 -3
- onnxtr-0.8.1/onnxtr/version.py +1 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr.egg-info/PKG-INFO +35 -6
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr.egg-info/requires.txt +4 -2
- {onnxtr-0.7.1 → onnxtr-0.8.1}/pyproject.toml +4 -2
- {onnxtr-0.7.1 → onnxtr-0.8.1}/setup.py +2 -2
- onnxtr-0.7.1/onnxtr/version.py +0 -1
- {onnxtr-0.7.1 → onnxtr-0.8.1}/LICENSE +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/__init__.py +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/contrib/__init__.py +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/io/__init__.py +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/__init__.py +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/classification/__init__.py +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/classification/models/__init__.py +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/classification/predictor/__init__.py +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/detection/__init__.py +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/detection/_utils/__init__.py +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/detection/models/__init__.py +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/detection/postprocessor/__init__.py +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/detection/predictor/__init__.py +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/factory/__init__.py +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/predictor/__init__.py +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/preprocessor/__init__.py +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/recognition/__init__.py +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/recognition/models/__init__.py +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/models/recognition/predictor/__init__.py +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/py.typed +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/transforms/__init__.py +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr/utils/__init__.py +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr.egg-info/SOURCES.txt +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr.egg-info/dependency_links.txt +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr.egg-info/top_level.txt +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/onnxtr.egg-info/zip-safe +0 -0
- {onnxtr-0.7.1 → onnxtr-0.8.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: onnxtr
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.1
|
|
4
4
|
Summary: Onnx Text Recognition (OnnxTR): docTR Onnx-Wrapper for high-performance OCR on documents.
|
|
5
5
|
Author-email: Felix Dittrich <felixdittrich92@gmail.com>
|
|
6
6
|
Maintainer: Felix Dittrich
|
|
@@ -227,11 +227,11 @@ Description-Content-Type: text/markdown
|
|
|
227
227
|
License-File: LICENSE
|
|
228
228
|
Requires-Dist: numpy<3.0.0,>=1.16.0
|
|
229
229
|
Requires-Dist: scipy<2.0.0,>=1.4.0
|
|
230
|
-
Requires-Dist: pypdfium2<
|
|
230
|
+
Requires-Dist: pypdfium2<6.0.0,>=4.11.0
|
|
231
231
|
Requires-Dist: pyclipper<2.0.0,>=1.2.0
|
|
232
232
|
Requires-Dist: rapidfuzz<4.0.0,>=3.0.0
|
|
233
233
|
Requires-Dist: langdetect<2.0.0,>=1.0.9
|
|
234
|
-
Requires-Dist: huggingface-hub<
|
|
234
|
+
Requires-Dist: huggingface-hub<2.0.0,>=0.23.0
|
|
235
235
|
Requires-Dist: Pillow>=9.2.0
|
|
236
236
|
Requires-Dist: defusedxml>=0.7.0
|
|
237
237
|
Requires-Dist: anyascii>=0.3.2
|
|
@@ -264,6 +264,7 @@ Requires-Dist: pytest>=5.3.2; extra == "testing"
|
|
|
264
264
|
Requires-Dist: coverage[toml]>=4.5.4; extra == "testing"
|
|
265
265
|
Requires-Dist: requests>=2.20.0; extra == "testing"
|
|
266
266
|
Requires-Dist: pytest-memray>=1.7.0; extra == "testing"
|
|
267
|
+
Requires-Dist: psutil>=7.0.0; extra == "testing"
|
|
267
268
|
Provides-Extra: quality
|
|
268
269
|
Requires-Dist: ruff>=0.1.5; extra == "quality"
|
|
269
270
|
Requires-Dist: mypy>=0.812; extra == "quality"
|
|
@@ -278,6 +279,7 @@ Requires-Dist: pytest>=5.3.2; extra == "dev"
|
|
|
278
279
|
Requires-Dist: coverage[toml]>=4.5.4; extra == "dev"
|
|
279
280
|
Requires-Dist: requests>=2.20.0; extra == "dev"
|
|
280
281
|
Requires-Dist: pytest-memray>=1.7.0; extra == "dev"
|
|
282
|
+
Requires-Dist: psutil>=7.0.0; extra == "dev"
|
|
281
283
|
Requires-Dist: ruff>=0.1.5; extra == "dev"
|
|
282
284
|
Requires-Dist: mypy>=0.812; extra == "dev"
|
|
283
285
|
Requires-Dist: pre-commit>=2.17.0; extra == "dev"
|
|
@@ -292,8 +294,8 @@ Dynamic: license-file
|
|
|
292
294
|
[](https://codecov.io/gh/felixdittrich92/OnnxTR)
|
|
293
295
|
[](https://app.codacy.com/gh/felixdittrich92/OnnxTR/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
|
294
296
|
[](https://www.codefactor.io/repository/github/felixdittrich92/onnxtr)
|
|
295
|
-
[](https://socket.dev/pypi/package/onnxtr/overview/0.8.1/tar-gz)
|
|
298
|
+
[](https://pypi.org/project/OnnxTR/)
|
|
297
299
|
[](https://github.com/felixdittrich92/OnnxTR/pkgs/container/onnxtr)
|
|
298
300
|
[](https://huggingface.co/spaces/Felix92/OnnxTR-OCR)
|
|
299
301
|

|
|
@@ -323,7 +325,7 @@ You can then install the latest release of the package using [pypi](https://pypi
|
|
|
323
325
|
|
|
324
326
|
**NOTE:**
|
|
325
327
|
|
|
326
|
-
Currently supported execution providers by default are: CPU, CUDA (NVIDIA GPU), OpenVINO (Intel CPU | GPU).
|
|
328
|
+
Currently supported execution providers by default are: CPU, CUDA (NVIDIA GPU), OpenVINO (Intel CPU | GPU), CoreML (Apple Silicon).
|
|
327
329
|
|
|
328
330
|
For GPU support please take a look at: [ONNX Runtime](https://onnxruntime.ai/getting-started).
|
|
329
331
|
|
|
@@ -353,6 +355,7 @@ If you have:
|
|
|
353
355
|
|
|
354
356
|
- a NVIDIA GPU, use one of the `gpu` variants
|
|
355
357
|
- an Intel CPU or GPU, use one of the `openvino` variants
|
|
358
|
+
- an Apple Silicon Mac, use one of the `cpu` variants (CoreML is auto-detected)
|
|
356
359
|
- otherwise, use one of the `cpu` variants
|
|
357
360
|
|
|
358
361
|
**OpenVINO:**
|
|
@@ -480,6 +483,32 @@ predictor = ocr_predictor(
|
|
|
480
483
|
)
|
|
481
484
|
```
|
|
482
485
|
|
|
486
|
+
You can also dynamically configure whether the memory arena should shrink:
|
|
487
|
+
|
|
488
|
+
```python
|
|
489
|
+
from random import random
|
|
490
|
+
from onnxruntime import RunOptions, SessionOptions
|
|
491
|
+
|
|
492
|
+
from onnxtr.models import ocr_predictor, EngineConfig
|
|
493
|
+
|
|
494
|
+
def arena_shrinkage_handler(run_options: RunOptions) -> RunOptions:
|
|
495
|
+
"""
|
|
496
|
+
Shrink the memory arena on 10% of inference runs.
|
|
497
|
+
"""
|
|
498
|
+
if random() < 0.1:
|
|
499
|
+
run_options.add_run_config_entry("memory.enable_memory_arena_shrinkage", "cpu:0")
|
|
500
|
+
return run_options
|
|
501
|
+
|
|
502
|
+
engine_config = EngineConfig(run_options_provider=arena_shrinkage_handler)
|
|
503
|
+
engine_config.session_options.enable_mem_pattern = False
|
|
504
|
+
|
|
505
|
+
predictor = ocr_predictor(
|
|
506
|
+
det_engine_cfg=engine_config,
|
|
507
|
+
reco_engine_cfg=engine_config,
|
|
508
|
+
clf_engine_cfg=engine_config
|
|
509
|
+
)
|
|
510
|
+
```
|
|
511
|
+
|
|
483
512
|
</details>
|
|
484
513
|
|
|
485
514
|
## Loading custom exported models
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
[](https://codecov.io/gh/felixdittrich92/OnnxTR)
|
|
8
8
|
[](https://app.codacy.com/gh/felixdittrich92/OnnxTR/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
|
9
9
|
[](https://www.codefactor.io/repository/github/felixdittrich92/onnxtr)
|
|
10
|
-
[](https://socket.dev/pypi/package/onnxtr/overview/0.8.1/tar-gz)
|
|
11
|
+
[](https://pypi.org/project/OnnxTR/)
|
|
12
12
|
[](https://github.com/felixdittrich92/OnnxTR/pkgs/container/onnxtr)
|
|
13
13
|
[](https://huggingface.co/spaces/Felix92/OnnxTR-OCR)
|
|
14
14
|

|
|
@@ -38,7 +38,7 @@ You can then install the latest release of the package using [pypi](https://pypi
|
|
|
38
38
|
|
|
39
39
|
**NOTE:**
|
|
40
40
|
|
|
41
|
-
Currently supported execution providers by default are: CPU, CUDA (NVIDIA GPU), OpenVINO (Intel CPU | GPU).
|
|
41
|
+
Currently supported execution providers by default are: CPU, CUDA (NVIDIA GPU), OpenVINO (Intel CPU | GPU), CoreML (Apple Silicon).
|
|
42
42
|
|
|
43
43
|
For GPU support please take a look at: [ONNX Runtime](https://onnxruntime.ai/getting-started).
|
|
44
44
|
|
|
@@ -68,6 +68,7 @@ If you have:
|
|
|
68
68
|
|
|
69
69
|
- a NVIDIA GPU, use one of the `gpu` variants
|
|
70
70
|
- an Intel CPU or GPU, use one of the `openvino` variants
|
|
71
|
+
- an Apple Silicon Mac, use one of the `cpu` variants (CoreML is auto-detected)
|
|
71
72
|
- otherwise, use one of the `cpu` variants
|
|
72
73
|
|
|
73
74
|
**OpenVINO:**
|
|
@@ -195,6 +196,32 @@ predictor = ocr_predictor(
|
|
|
195
196
|
)
|
|
196
197
|
```
|
|
197
198
|
|
|
199
|
+
You can also dynamically configure whether the memory arena should shrink:
|
|
200
|
+
|
|
201
|
+
```python
|
|
202
|
+
from random import random
|
|
203
|
+
from onnxruntime import RunOptions, SessionOptions
|
|
204
|
+
|
|
205
|
+
from onnxtr.models import ocr_predictor, EngineConfig
|
|
206
|
+
|
|
207
|
+
def arena_shrinkage_handler(run_options: RunOptions) -> RunOptions:
|
|
208
|
+
"""
|
|
209
|
+
Shrink the memory arena on 10% of inference runs.
|
|
210
|
+
"""
|
|
211
|
+
if random() < 0.1:
|
|
212
|
+
run_options.add_run_config_entry("memory.enable_memory_arena_shrinkage", "cpu:0")
|
|
213
|
+
return run_options
|
|
214
|
+
|
|
215
|
+
engine_config = EngineConfig(run_options_provider=arena_shrinkage_handler)
|
|
216
|
+
engine_config.session_options.enable_mem_pattern = False
|
|
217
|
+
|
|
218
|
+
predictor = ocr_predictor(
|
|
219
|
+
det_engine_cfg=engine_config,
|
|
220
|
+
reco_engine_cfg=engine_config,
|
|
221
|
+
clf_engine_cfg=engine_config
|
|
222
|
+
)
|
|
223
|
+
```
|
|
224
|
+
|
|
198
225
|
</details>
|
|
199
226
|
|
|
200
227
|
## Loading custom exported models
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
# Copyright (C) 2021-
|
|
1
|
+
# Copyright (C) 2021-2026, Mindee | Felix Dittrich.
|
|
2
2
|
|
|
3
3
|
# This program is licensed under the Apache License 2.0.
|
|
4
4
|
# See LICENSE or go to <https://opensource.org/licenses/Apache-2.0> for full license details.
|
|
5
5
|
|
|
6
6
|
import importlib.metadata
|
|
7
|
-
import importlib.util
|
|
8
7
|
import logging
|
|
9
8
|
|
|
10
9
|
__all__ = ["requires_package"]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2021-
|
|
1
|
+
# Copyright (C) 2021-2026, Mindee | Felix Dittrich.
|
|
2
2
|
|
|
3
3
|
# This program is licensed under the Apache License 2.0.
|
|
4
4
|
# See LICENSE or go to <https://opensource.org/licenses/Apache-2.0> for full license details.
|
|
@@ -25,6 +25,8 @@ def get_max_width_length_ratio(contour: np.ndarray) -> float:
|
|
|
25
25
|
the maximum shape ratio
|
|
26
26
|
"""
|
|
27
27
|
_, (w, h), _ = cv2.minAreaRect(contour)
|
|
28
|
+
if w == 0 or h == 0:
|
|
29
|
+
return 0.0
|
|
28
30
|
return max(w / h, h / w)
|
|
29
31
|
|
|
30
32
|
|
|
@@ -52,7 +54,7 @@ def estimate_orientation(
|
|
|
52
54
|
the estimated angle of the page (clockwise, negative for left side rotation, positive for right side rotation)
|
|
53
55
|
"""
|
|
54
56
|
assert len(img.shape) == 3 and img.shape[-1] in [1, 3], f"Image shape {img.shape} not supported"
|
|
55
|
-
|
|
57
|
+
|
|
56
58
|
# Convert image to grayscale if necessary
|
|
57
59
|
if img.shape[-1] == 3:
|
|
58
60
|
gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
|
@@ -61,11 +63,14 @@ def estimate_orientation(
|
|
|
61
63
|
else:
|
|
62
64
|
thresh = img.astype(np.uint8)
|
|
63
65
|
|
|
64
|
-
page_orientation, orientation_confidence = general_page_orientation or (
|
|
65
|
-
|
|
66
|
+
page_orientation, orientation_confidence = general_page_orientation or (0, 0.0)
|
|
67
|
+
is_confident = page_orientation is not None and orientation_confidence >= min_confidence
|
|
68
|
+
base_angle = page_orientation if is_confident else 0
|
|
69
|
+
|
|
70
|
+
if is_confident:
|
|
66
71
|
# We rotate the image to the general orientation which improves the detection
|
|
67
72
|
# No expand needed bitmap is already padded
|
|
68
|
-
thresh = rotate_image(thresh, -
|
|
73
|
+
thresh = rotate_image(thresh, -base_angle)
|
|
69
74
|
else: # That's only required if we do not work on the detection models bin map
|
|
70
75
|
# try to merge words in lines
|
|
71
76
|
(h, w) = img.shape[:2]
|
|
@@ -87,30 +92,63 @@ def estimate_orientation(
|
|
|
87
92
|
angles = []
|
|
88
93
|
for contour in contours[:n_ct]:
|
|
89
94
|
_, (w, h), angle = cv2.minAreaRect(contour)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
|
|
96
|
+
# OpenCV version-proof normalization: force 'w' to be the long side
|
|
97
|
+
# so the angle is consistently relative to the major axis.
|
|
98
|
+
# https://github.com/opencv/opencv/pull/28051/changes
|
|
99
|
+
if w < h:
|
|
100
|
+
w, h = h, w
|
|
101
|
+
angle -= 90
|
|
102
|
+
|
|
103
|
+
# Normalize angle to be within [-90, 90]
|
|
104
|
+
while angle <= -90:
|
|
105
|
+
angle += 180
|
|
106
|
+
while angle > 90:
|
|
107
|
+
angle -= 180
|
|
108
|
+
|
|
109
|
+
if h > 0:
|
|
110
|
+
if w / h > ratio_threshold_for_lines: # select only contours with ratio like lines
|
|
111
|
+
angles.append(angle)
|
|
112
|
+
elif w / h < 1 / ratio_threshold_for_lines: # if lines are vertical, substract 90 degree
|
|
113
|
+
angles.append(angle - 90)
|
|
94
114
|
|
|
95
115
|
if len(angles) == 0:
|
|
96
|
-
|
|
116
|
+
skew_angle = 0 # in case no angles is found
|
|
97
117
|
else:
|
|
118
|
+
# median_low picks a value from the data to avoid outliers
|
|
98
119
|
median = -median_low(angles)
|
|
99
|
-
|
|
120
|
+
skew_angle = -round(median) if abs(median) != 0 else 0
|
|
121
|
+
|
|
122
|
+
# Resolve the 90-degree flip ambiguity.
|
|
123
|
+
# If the estimation is exactly 90/-90, it's usually a vertical detection of horizontal lines.
|
|
124
|
+
if abs(skew_angle) == 90:
|
|
125
|
+
skew_angle = 0
|
|
100
126
|
|
|
101
127
|
# combine with the general orientation and the estimated angle
|
|
102
|
-
|
|
128
|
+
# Apply the detected skew to our base orientation
|
|
129
|
+
final_angle = base_angle + skew_angle
|
|
130
|
+
|
|
131
|
+
# Standardize result to [-179, 180] range to handle wrap-around cases (e.g., 180 + -31)
|
|
132
|
+
while final_angle > 180:
|
|
133
|
+
final_angle -= 360
|
|
134
|
+
while final_angle <= -180:
|
|
135
|
+
final_angle += 360
|
|
136
|
+
|
|
137
|
+
if is_confident:
|
|
138
|
+
# If the estimated angle is perpendicular, treat it as 0 to avoid wrong flips
|
|
139
|
+
if abs(skew_angle) % 90 == 0:
|
|
140
|
+
return page_orientation
|
|
141
|
+
|
|
103
142
|
# special case where the estimated angle is mostly wrong:
|
|
104
143
|
# case 1: - and + swapped
|
|
105
144
|
# case 2: estimated angle is completely wrong
|
|
106
145
|
# so in this case we prefer the general page orientation
|
|
107
|
-
if abs(
|
|
146
|
+
if abs(skew_angle) == abs(page_orientation) and page_orientation != 0:
|
|
108
147
|
return page_orientation
|
|
109
|
-
estimated_angle = estimated_angle if page_orientation == 0 else page_orientation + estimated_angle
|
|
110
|
-
if estimated_angle > 180:
|
|
111
|
-
estimated_angle -= 360
|
|
112
148
|
|
|
113
|
-
return
|
|
149
|
+
return int(
|
|
150
|
+
final_angle
|
|
151
|
+
) # return the clockwise angle (negative - left side rotation, positive - right side rotation)
|
|
114
152
|
|
|
115
153
|
|
|
116
154
|
def rectify_crops(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2021-
|
|
1
|
+
# Copyright (C) 2021-2026, Mindee | Felix Dittrich.
|
|
2
2
|
|
|
3
3
|
# This program is licensed under the Apache License 2.0.
|
|
4
4
|
# See LICENSE or go to <https://opensource.org/licenses/Apache-2.0> for full license details.
|
|
@@ -53,7 +53,7 @@ class DetectionPostProcessor(NestedObject):
|
|
|
53
53
|
|
|
54
54
|
else:
|
|
55
55
|
mask: np.ndarray = np.zeros((h, w), np.int32)
|
|
56
|
-
cv2.fillPoly(mask, [points.astype(np.int32)], 1.0)
|
|
56
|
+
cv2.fillPoly(mask, [points.astype(np.int32)], 1.0)
|
|
57
57
|
product = pred * mask
|
|
58
58
|
return np.sum(product) / np.count_nonzero(product)
|
|
59
59
|
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
# Copyright (C) 2021-
|
|
1
|
+
# Copyright (C) 2021-2026, Mindee | Felix Dittrich.
|
|
2
2
|
|
|
3
3
|
# This program is licensed under the Apache License 2.0.
|
|
4
4
|
# See LICENSE or go to <https://opensource.org/licenses/Apache-2.0> for full license details.
|
|
5
5
|
|
|
6
6
|
import logging
|
|
7
7
|
import os
|
|
8
|
-
from
|
|
8
|
+
from collections.abc import Callable
|
|
9
|
+
from typing import Any, TypeAlias
|
|
9
10
|
|
|
10
11
|
import numpy as np
|
|
11
12
|
from onnxruntime import (
|
|
12
13
|
ExecutionMode,
|
|
13
14
|
GraphOptimizationLevel,
|
|
14
15
|
InferenceSession,
|
|
16
|
+
RunOptions,
|
|
15
17
|
SessionOptions,
|
|
16
18
|
get_available_providers,
|
|
17
19
|
get_device,
|
|
@@ -23,7 +25,9 @@ set_default_logger_severity(int(os.getenv("ORT_LOG_SEVERITY_LEVEL", 4)))
|
|
|
23
25
|
from onnxtr.utils.data import download_from_url
|
|
24
26
|
from onnxtr.utils.geometry import shape_translate
|
|
25
27
|
|
|
26
|
-
__all__ = ["EngineConfig"]
|
|
28
|
+
__all__ = ["EngineConfig", "RunOptionsProvider"]
|
|
29
|
+
|
|
30
|
+
RunOptionsProvider: TypeAlias = Callable[[RunOptions], RunOptions]
|
|
27
31
|
|
|
28
32
|
|
|
29
33
|
class EngineConfig:
|
|
@@ -38,9 +42,11 @@ class EngineConfig:
|
|
|
38
42
|
self,
|
|
39
43
|
providers: list[tuple[str, dict[str, Any]]] | list[str] | None = None,
|
|
40
44
|
session_options: SessionOptions | None = None,
|
|
45
|
+
run_options_provider: RunOptionsProvider | None = None,
|
|
41
46
|
):
|
|
42
47
|
self._providers = providers or self._init_providers()
|
|
43
48
|
self._session_options = session_options or self._init_sess_opts()
|
|
49
|
+
self.run_options_provider = run_options_provider
|
|
44
50
|
|
|
45
51
|
def _init_providers(self) -> list[tuple[str, dict[str, Any]]]:
|
|
46
52
|
providers: Any = [("CPUExecutionProvider", {"arena_extend_strategy": "kSameAsRequested"})]
|
|
@@ -59,6 +65,8 @@ class EngineConfig:
|
|
|
59
65
|
},
|
|
60
66
|
),
|
|
61
67
|
)
|
|
68
|
+
elif "CoreMLExecutionProvider" in available_providers: # pragma: no cover
|
|
69
|
+
providers.insert(0, ("CoreMLExecutionProvider", {}))
|
|
62
70
|
return providers
|
|
63
71
|
|
|
64
72
|
def _init_sess_opts(self) -> SessionOptions:
|
|
@@ -79,7 +87,7 @@ class EngineConfig:
|
|
|
79
87
|
return self._session_options
|
|
80
88
|
|
|
81
89
|
def __repr__(self) -> str:
|
|
82
|
-
return f"EngineConfig(providers={self.providers}"
|
|
90
|
+
return f"EngineConfig(providers={self.providers})"
|
|
83
91
|
|
|
84
92
|
|
|
85
93
|
class Engine:
|
|
@@ -100,6 +108,7 @@ class Engine:
|
|
|
100
108
|
self.model_path = archive_path
|
|
101
109
|
self.session_options = engine_cfg.session_options
|
|
102
110
|
self.providers = engine_cfg.providers
|
|
111
|
+
self.run_options_provider = engine_cfg.run_options_provider
|
|
103
112
|
self.runtime = InferenceSession(archive_path, providers=self.providers, sess_options=self.session_options)
|
|
104
113
|
self.runtime_inputs = self.runtime.get_inputs()[0]
|
|
105
114
|
self.tf_exported = int(self.runtime_inputs.shape[-1]) == 3
|
|
@@ -109,6 +118,9 @@ class Engine:
|
|
|
109
118
|
self.output_name = [output.name for output in self.runtime.get_outputs()]
|
|
110
119
|
|
|
111
120
|
def run(self, inputs: np.ndarray) -> np.ndarray:
|
|
121
|
+
run_options = RunOptions()
|
|
122
|
+
if self.run_options_provider is not None:
|
|
123
|
+
run_options = self.run_options_provider(run_options)
|
|
112
124
|
if self.tf_exported:
|
|
113
125
|
inputs = shape_translate(inputs, format="BHWC") # sanity check
|
|
114
126
|
else:
|
|
@@ -117,8 +129,12 @@ class Engine:
|
|
|
117
129
|
inputs = np.broadcast_to(inputs, (self.fixed_batch_size, *inputs.shape))
|
|
118
130
|
# combine the results
|
|
119
131
|
logits = np.concatenate(
|
|
120
|
-
[
|
|
132
|
+
[
|
|
133
|
+
self.runtime.run(self.output_name, {self.runtime_inputs.name: batch}, run_options=run_options)[0]
|
|
134
|
+
for batch in inputs
|
|
135
|
+
],
|
|
136
|
+
axis=0,
|
|
121
137
|
)
|
|
122
138
|
else:
|
|
123
|
-
logits = self.runtime.run(self.output_name, {self.runtime_inputs.name: inputs})[0]
|
|
139
|
+
logits = self.runtime.run(self.output_name, {self.runtime_inputs.name: inputs}, run_options=run_options)[0]
|
|
124
140
|
return shape_translate(logits, format="BHWC")
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2021-
|
|
1
|
+
# Copyright (C) 2021-2026, Mindee | Felix Dittrich.
|
|
2
2
|
|
|
3
3
|
# This program is licensed under the Apache License 2.0.
|
|
4
4
|
# See LICENSE or go to <https://opensource.org/licenses/Apache-2.0> for full license details.
|
|
@@ -7,18 +7,16 @@
|
|
|
7
7
|
|
|
8
8
|
import json
|
|
9
9
|
import logging
|
|
10
|
-
import os
|
|
11
10
|
import shutil
|
|
12
11
|
import subprocess
|
|
12
|
+
import tempfile
|
|
13
13
|
import textwrap
|
|
14
14
|
from pathlib import Path
|
|
15
15
|
from typing import Any
|
|
16
16
|
|
|
17
17
|
from huggingface_hub import (
|
|
18
18
|
HfApi,
|
|
19
|
-
Repository,
|
|
20
19
|
get_token,
|
|
21
|
-
get_token_permission,
|
|
22
20
|
hf_hub_download,
|
|
23
21
|
login,
|
|
24
22
|
)
|
|
@@ -39,9 +37,9 @@ AVAILABLE_ARCHS = {
|
|
|
39
37
|
def login_to_hub() -> None: # pragma: no cover
|
|
40
38
|
"""Login to huggingface hub"""
|
|
41
39
|
access_token = get_token()
|
|
42
|
-
if access_token is not None
|
|
40
|
+
if access_token is not None:
|
|
43
41
|
logging.info("Huggingface Hub token found and valid")
|
|
44
|
-
login(token=access_token
|
|
42
|
+
login(token=access_token)
|
|
45
43
|
else:
|
|
46
44
|
login()
|
|
47
45
|
# check if git lfs is installed
|
|
@@ -165,16 +163,23 @@ def push_to_hf_hub(
|
|
|
165
163
|
|
|
166
164
|
commit_message = f"Add {model_name} model"
|
|
167
165
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
166
|
+
# Create repository
|
|
167
|
+
api = HfApi()
|
|
168
|
+
api.create_repo(model_name, token=get_token(), exist_ok=False)
|
|
171
169
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
170
|
+
# Save model files to a temporary directory
|
|
171
|
+
with tempfile.TemporaryDirectory() as tmp_dir:
|
|
172
|
+
_save_model_and_config_for_hf_hub(model, tmp_dir, arch=arch, task=task)
|
|
173
|
+
readme_path = Path(tmp_dir) / "README.md"
|
|
175
174
|
readme_path.write_text(readme)
|
|
176
175
|
|
|
177
|
-
|
|
176
|
+
# Upload all files to the hub
|
|
177
|
+
api.upload_folder(
|
|
178
|
+
folder_path=tmp_dir,
|
|
179
|
+
repo_id=model_name,
|
|
180
|
+
commit_message=commit_message,
|
|
181
|
+
token=get_token(),
|
|
182
|
+
)
|
|
178
183
|
|
|
179
184
|
|
|
180
185
|
def from_hub(repo_id: str, engine_cfg: EngineConfig | None = None, **kwargs: Any):
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2021-
|
|
1
|
+
# Copyright (C) 2021-2026, Mindee | Felix Dittrich.
|
|
2
2
|
|
|
3
3
|
# This program is licensed under the Apache License 2.0.
|
|
4
4
|
# See LICENSE or go to <https://opensource.org/licenses/Apache-2.0> for full license details.
|
|
@@ -22,9 +22,9 @@ default_cfgs: dict[str, dict[str, Any]] = {
|
|
|
22
22
|
"mean": (0.694, 0.695, 0.693),
|
|
23
23
|
"std": (0.299, 0.296, 0.301),
|
|
24
24
|
"input_shape": (3, 32, 128),
|
|
25
|
-
"vocab": VOCABS["
|
|
26
|
-
"url": "https://github.com/felixdittrich92/OnnxTR/releases/download/v0.
|
|
27
|
-
"url_8_bit": "https://github.com/felixdittrich92/OnnxTR/releases/download/v0.1
|
|
25
|
+
"vocab": VOCABS["french"],
|
|
26
|
+
"url": "https://github.com/felixdittrich92/OnnxTR/releases/download/v0.7.1/crnn_vgg16_bn-743599aa.onnx",
|
|
27
|
+
"url_8_bit": "https://github.com/felixdittrich92/OnnxTR/releases/download/v0.7.1/crnn_vgg16_bn_static_8_bit-df1b594d.onnx",
|
|
28
28
|
},
|
|
29
29
|
"crnn_mobilenet_v3_small": {
|
|
30
30
|
"mean": (0.694, 0.695, 0.693),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2021-
|
|
1
|
+
# Copyright (C) 2021-2026, Mindee | Felix Dittrich.
|
|
2
2
|
|
|
3
3
|
# This program is licensed under the Apache License 2.0.
|
|
4
4
|
# See LICENSE or go to <https://opensource.org/licenses/Apache-2.0> for full license details.
|
|
@@ -9,7 +9,6 @@ import hashlib
|
|
|
9
9
|
import logging
|
|
10
10
|
import os
|
|
11
11
|
import re
|
|
12
|
-
import urllib
|
|
13
12
|
import urllib.error
|
|
14
13
|
import urllib.request
|
|
15
14
|
from pathlib import Path
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2021-
|
|
1
|
+
# Copyright (C) 2021-2026, Mindee | Felix Dittrich.
|
|
2
2
|
|
|
3
3
|
# This program is licensed under the Apache License 2.0.
|
|
4
4
|
# See LICENSE or go to <https://opensource.org/licenses/Apache-2.0> for full license details.
|
|
@@ -264,8 +264,6 @@ VOCABS["estonian"] = VOCABS["english"] + "šžõäöüŠŽÕÄÖÜ"
|
|
|
264
264
|
VOCABS["esperanto"] = re.sub(r"[QqWwXxYy]", "", VOCABS["english"]) + "ĉĝĥĵŝŭĈĜĤĴŜŬ" + "₷"
|
|
265
265
|
|
|
266
266
|
VOCABS["french"] = VOCABS["english"] + "àâéèêëîïôùûüçÀÂÉÈÊËÎÏÔÙÛÜÇ"
|
|
267
|
-
# NOTE: legacy french is outdated, but kept for compatibility
|
|
268
|
-
VOCABS["legacy_french"] = VOCABS["latin"] + "°" + "àâéèêëîïôùûçÀÂÉÈËÎÏÔÙÛÇ" + _BASE_VOCABS["currency"]
|
|
269
267
|
|
|
270
268
|
VOCABS["finnish"] = VOCABS["english"] + "äöÄÖ"
|
|
271
269
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = 'v0.8.1'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: onnxtr
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.1
|
|
4
4
|
Summary: Onnx Text Recognition (OnnxTR): docTR Onnx-Wrapper for high-performance OCR on documents.
|
|
5
5
|
Author-email: Felix Dittrich <felixdittrich92@gmail.com>
|
|
6
6
|
Maintainer: Felix Dittrich
|
|
@@ -227,11 +227,11 @@ Description-Content-Type: text/markdown
|
|
|
227
227
|
License-File: LICENSE
|
|
228
228
|
Requires-Dist: numpy<3.0.0,>=1.16.0
|
|
229
229
|
Requires-Dist: scipy<2.0.0,>=1.4.0
|
|
230
|
-
Requires-Dist: pypdfium2<
|
|
230
|
+
Requires-Dist: pypdfium2<6.0.0,>=4.11.0
|
|
231
231
|
Requires-Dist: pyclipper<2.0.0,>=1.2.0
|
|
232
232
|
Requires-Dist: rapidfuzz<4.0.0,>=3.0.0
|
|
233
233
|
Requires-Dist: langdetect<2.0.0,>=1.0.9
|
|
234
|
-
Requires-Dist: huggingface-hub<
|
|
234
|
+
Requires-Dist: huggingface-hub<2.0.0,>=0.23.0
|
|
235
235
|
Requires-Dist: Pillow>=9.2.0
|
|
236
236
|
Requires-Dist: defusedxml>=0.7.0
|
|
237
237
|
Requires-Dist: anyascii>=0.3.2
|
|
@@ -264,6 +264,7 @@ Requires-Dist: pytest>=5.3.2; extra == "testing"
|
|
|
264
264
|
Requires-Dist: coverage[toml]>=4.5.4; extra == "testing"
|
|
265
265
|
Requires-Dist: requests>=2.20.0; extra == "testing"
|
|
266
266
|
Requires-Dist: pytest-memray>=1.7.0; extra == "testing"
|
|
267
|
+
Requires-Dist: psutil>=7.0.0; extra == "testing"
|
|
267
268
|
Provides-Extra: quality
|
|
268
269
|
Requires-Dist: ruff>=0.1.5; extra == "quality"
|
|
269
270
|
Requires-Dist: mypy>=0.812; extra == "quality"
|
|
@@ -278,6 +279,7 @@ Requires-Dist: pytest>=5.3.2; extra == "dev"
|
|
|
278
279
|
Requires-Dist: coverage[toml]>=4.5.4; extra == "dev"
|
|
279
280
|
Requires-Dist: requests>=2.20.0; extra == "dev"
|
|
280
281
|
Requires-Dist: pytest-memray>=1.7.0; extra == "dev"
|
|
282
|
+
Requires-Dist: psutil>=7.0.0; extra == "dev"
|
|
281
283
|
Requires-Dist: ruff>=0.1.5; extra == "dev"
|
|
282
284
|
Requires-Dist: mypy>=0.812; extra == "dev"
|
|
283
285
|
Requires-Dist: pre-commit>=2.17.0; extra == "dev"
|
|
@@ -292,8 +294,8 @@ Dynamic: license-file
|
|
|
292
294
|
[](https://codecov.io/gh/felixdittrich92/OnnxTR)
|
|
293
295
|
[](https://app.codacy.com/gh/felixdittrich92/OnnxTR/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
|
294
296
|
[](https://www.codefactor.io/repository/github/felixdittrich92/onnxtr)
|
|
295
|
-
[](https://socket.dev/pypi/package/onnxtr/overview/0.8.1/tar-gz)
|
|
298
|
+
[](https://pypi.org/project/OnnxTR/)
|
|
297
299
|
[](https://github.com/felixdittrich92/OnnxTR/pkgs/container/onnxtr)
|
|
298
300
|
[](https://huggingface.co/spaces/Felix92/OnnxTR-OCR)
|
|
299
301
|

|
|
@@ -323,7 +325,7 @@ You can then install the latest release of the package using [pypi](https://pypi
|
|
|
323
325
|
|
|
324
326
|
**NOTE:**
|
|
325
327
|
|
|
326
|
-
Currently supported execution providers by default are: CPU, CUDA (NVIDIA GPU), OpenVINO (Intel CPU | GPU).
|
|
328
|
+
Currently supported execution providers by default are: CPU, CUDA (NVIDIA GPU), OpenVINO (Intel CPU | GPU), CoreML (Apple Silicon).
|
|
327
329
|
|
|
328
330
|
For GPU support please take a look at: [ONNX Runtime](https://onnxruntime.ai/getting-started).
|
|
329
331
|
|
|
@@ -353,6 +355,7 @@ If you have:
|
|
|
353
355
|
|
|
354
356
|
- a NVIDIA GPU, use one of the `gpu` variants
|
|
355
357
|
- an Intel CPU or GPU, use one of the `openvino` variants
|
|
358
|
+
- an Apple Silicon Mac, use one of the `cpu` variants (CoreML is auto-detected)
|
|
356
359
|
- otherwise, use one of the `cpu` variants
|
|
357
360
|
|
|
358
361
|
**OpenVINO:**
|
|
@@ -480,6 +483,32 @@ predictor = ocr_predictor(
|
|
|
480
483
|
)
|
|
481
484
|
```
|
|
482
485
|
|
|
486
|
+
You can also dynamically configure whether the memory arena should shrink:
|
|
487
|
+
|
|
488
|
+
```python
|
|
489
|
+
from random import random
|
|
490
|
+
from onnxruntime import RunOptions, SessionOptions
|
|
491
|
+
|
|
492
|
+
from onnxtr.models import ocr_predictor, EngineConfig
|
|
493
|
+
|
|
494
|
+
def arena_shrinkage_handler(run_options: RunOptions) -> RunOptions:
|
|
495
|
+
"""
|
|
496
|
+
Shrink the memory arena on 10% of inference runs.
|
|
497
|
+
"""
|
|
498
|
+
if random() < 0.1:
|
|
499
|
+
run_options.add_run_config_entry("memory.enable_memory_arena_shrinkage", "cpu:0")
|
|
500
|
+
return run_options
|
|
501
|
+
|
|
502
|
+
engine_config = EngineConfig(run_options_provider=arena_shrinkage_handler)
|
|
503
|
+
engine_config.session_options.enable_mem_pattern = False
|
|
504
|
+
|
|
505
|
+
predictor = ocr_predictor(
|
|
506
|
+
det_engine_cfg=engine_config,
|
|
507
|
+
reco_engine_cfg=engine_config,
|
|
508
|
+
clf_engine_cfg=engine_config
|
|
509
|
+
)
|
|
510
|
+
```
|
|
511
|
+
|
|
483
512
|
</details>
|
|
484
513
|
|
|
485
514
|
## Loading custom exported models
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
numpy<3.0.0,>=1.16.0
|
|
2
2
|
scipy<2.0.0,>=1.4.0
|
|
3
|
-
pypdfium2<
|
|
3
|
+
pypdfium2<6.0.0,>=4.11.0
|
|
4
4
|
pyclipper<2.0.0,>=1.2.0
|
|
5
5
|
rapidfuzz<4.0.0,>=3.0.0
|
|
6
6
|
langdetect<2.0.0,>=1.0.9
|
|
7
|
-
huggingface-hub<
|
|
7
|
+
huggingface-hub<2.0.0,>=0.23.0
|
|
8
8
|
Pillow>=9.2.0
|
|
9
9
|
defusedxml>=0.7.0
|
|
10
10
|
anyascii>=0.3.2
|
|
@@ -28,6 +28,7 @@ pytest>=5.3.2
|
|
|
28
28
|
coverage[toml]>=4.5.4
|
|
29
29
|
requests>=2.20.0
|
|
30
30
|
pytest-memray>=1.7.0
|
|
31
|
+
psutil>=7.0.0
|
|
31
32
|
ruff>=0.1.5
|
|
32
33
|
mypy>=0.812
|
|
33
34
|
pre-commit>=2.17.0
|
|
@@ -61,6 +62,7 @@ pytest>=5.3.2
|
|
|
61
62
|
coverage[toml]>=4.5.4
|
|
62
63
|
requests>=2.20.0
|
|
63
64
|
pytest-memray>=1.7.0
|
|
65
|
+
psutil>=7.0.0
|
|
64
66
|
|
|
65
67
|
[viz]
|
|
66
68
|
matplotlib>=3.1.0
|
|
@@ -33,11 +33,11 @@ dependencies = [
|
|
|
33
33
|
# Additional typing support is brought by numpy>=1.22.4, but core build sticks to >=1.16.0
|
|
34
34
|
"numpy>=1.16.0,<3.0.0",
|
|
35
35
|
"scipy>=1.4.0,<2.0.0",
|
|
36
|
-
"pypdfium2>=4.11.0,<
|
|
36
|
+
"pypdfium2>=4.11.0,<6.0.0",
|
|
37
37
|
"pyclipper>=1.2.0,<2.0.0",
|
|
38
38
|
"rapidfuzz>=3.0.0,<4.0.0",
|
|
39
39
|
"langdetect>=1.0.9,<2.0.0",
|
|
40
|
-
"huggingface-hub>=0.23.0,<
|
|
40
|
+
"huggingface-hub>=0.23.0,<2.0.0",
|
|
41
41
|
"Pillow>=9.2.0",
|
|
42
42
|
"defusedxml>=0.7.0",
|
|
43
43
|
"anyascii>=0.3.2",
|
|
@@ -81,6 +81,7 @@ testing = [
|
|
|
81
81
|
"coverage[toml]>=4.5.4",
|
|
82
82
|
"requests>=2.20.0",
|
|
83
83
|
"pytest-memray>=1.7.0",
|
|
84
|
+
"psutil>=7.0.0",
|
|
84
85
|
]
|
|
85
86
|
quality = [
|
|
86
87
|
"ruff>=0.1.5",
|
|
@@ -101,6 +102,7 @@ dev = [
|
|
|
101
102
|
"coverage[toml]>=4.5.4",
|
|
102
103
|
"requests>=2.20.0",
|
|
103
104
|
"pytest-memray>=1.7.0",
|
|
105
|
+
"psutil>=7.0.0",
|
|
104
106
|
# Quality
|
|
105
107
|
"ruff>=0.1.5",
|
|
106
108
|
"mypy>=0.812",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2021-
|
|
1
|
+
# Copyright (C) 2021-2026, Mindee | Felix Dittrich.
|
|
2
2
|
|
|
3
3
|
# This program is licensed under the Apache License 2.0.
|
|
4
4
|
# See LICENSE or go to <https://opensource.org/licenses/Apache-2.0> for full license details.
|
|
@@ -9,7 +9,7 @@ from pathlib import Path
|
|
|
9
9
|
from setuptools import setup
|
|
10
10
|
|
|
11
11
|
PKG_NAME = "onnxtr"
|
|
12
|
-
VERSION = os.getenv("BUILD_VERSION", "0.
|
|
12
|
+
VERSION = os.getenv("BUILD_VERSION", "0.8.1a0")
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
if __name__ == "__main__":
|
onnxtr-0.7.1/onnxtr/version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = 'v0.7.1'
|
|
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
|