onnxtr 0.3.0__py3-none-any.whl → 0.3.2__py3-none-any.whl

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/contrib/base.py CHANGED
@@ -6,8 +6,8 @@
6
6
  from typing import Any, List, Optional
7
7
 
8
8
  import numpy as np
9
+ import onnxruntime as ort
9
10
 
10
- from onnxtr.file_utils import requires_package
11
11
  from onnxtr.utils.data import download_from_url
12
12
 
13
13
 
@@ -44,9 +44,6 @@ class _BasePredictor:
44
44
  -------
45
45
  Any: the ONNX loaded model
46
46
  """
47
- requires_package("onnxruntime", "`.contrib` module requires `onnxruntime` to be installed.")
48
- import onnxruntime as ort
49
-
50
47
  if not url and not model_path:
51
48
  raise ValueError("You must provide either a url or a model_path")
52
49
  onnx_model_path = model_path if model_path else str(download_from_url(url, cache_subdir="models", **kwargs)) # type: ignore[arg-type]
@@ -51,7 +51,7 @@ class MobileNetV3(Engine):
51
51
  def __init__(
52
52
  self,
53
53
  model_path: str,
54
- engine_cfg: EngineConfig = EngineConfig(),
54
+ engine_cfg: Optional[EngineConfig] = None,
55
55
  cfg: Optional[Dict[str, Any]] = None,
56
56
  **kwargs: Any,
57
57
  ) -> None:
@@ -69,7 +69,7 @@ def _mobilenet_v3(
69
69
  arch: str,
70
70
  model_path: str,
71
71
  load_in_8_bit: bool = False,
72
- engine_cfg: EngineConfig = EngineConfig(),
72
+ engine_cfg: Optional[EngineConfig] = None,
73
73
  **kwargs: Any,
74
74
  ) -> MobileNetV3:
75
75
  # Patch the url
@@ -81,7 +81,7 @@ def _mobilenet_v3(
81
81
  def mobilenet_v3_small_crop_orientation(
82
82
  model_path: str = default_cfgs["mobilenet_v3_small_crop_orientation"]["url"],
83
83
  load_in_8_bit: bool = False,
84
- engine_cfg: EngineConfig = EngineConfig(),
84
+ engine_cfg: Optional[EngineConfig] = None,
85
85
  **kwargs: Any,
86
86
  ) -> MobileNetV3:
87
87
  """MobileNetV3-Small architecture as described in
@@ -111,7 +111,7 @@ def mobilenet_v3_small_crop_orientation(
111
111
  def mobilenet_v3_small_page_orientation(
112
112
  model_path: str = default_cfgs["mobilenet_v3_small_page_orientation"]["url"],
113
113
  load_in_8_bit: bool = False,
114
- engine_cfg: EngineConfig = EngineConfig(),
114
+ engine_cfg: Optional[EngineConfig] = None,
115
115
  **kwargs: Any,
116
116
  ) -> MobileNetV3:
117
117
  """MobileNetV3-Small architecture as described in
@@ -3,7 +3,7 @@
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
- from typing import Any, List
6
+ from typing import Any, List, Optional
7
7
 
8
8
  from onnxtr.models.engine import EngineConfig
9
9
 
@@ -17,7 +17,7 @@ ORIENTATION_ARCHS: List[str] = ["mobilenet_v3_small_crop_orientation", "mobilene
17
17
 
18
18
 
19
19
  def _orientation_predictor(
20
- arch: str, load_in_8_bit: bool = False, engine_cfg: EngineConfig = EngineConfig(), **kwargs: Any
20
+ arch: str, load_in_8_bit: bool = False, engine_cfg: Optional[EngineConfig] = None, **kwargs: Any
21
21
  ) -> OrientationPredictor:
22
22
  if arch not in ORIENTATION_ARCHS:
23
23
  raise ValueError(f"unknown architecture '{arch}'")
@@ -26,7 +26,7 @@ def _orientation_predictor(
26
26
  _model = classification.__dict__[arch](load_in_8_bit=load_in_8_bit, engine_cfg=engine_cfg)
27
27
  kwargs["mean"] = kwargs.get("mean", _model.cfg["mean"])
28
28
  kwargs["std"] = kwargs.get("std", _model.cfg["std"])
29
- kwargs["batch_size"] = kwargs.get("batch_size", 128 if "crop" in arch else 4)
29
+ kwargs["batch_size"] = kwargs.get("batch_size", 512 if "crop" in arch else 2)
30
30
  input_shape = _model.cfg["input_shape"][1:]
31
31
  predictor = OrientationPredictor(
32
32
  PreProcessor(input_shape, preserve_aspect_ratio=True, symmetric_pad=True, **kwargs),
@@ -38,7 +38,7 @@ def _orientation_predictor(
38
38
  def crop_orientation_predictor(
39
39
  arch: Any = "mobilenet_v3_small_crop_orientation",
40
40
  load_in_8_bit: bool = False,
41
- engine_cfg: EngineConfig = EngineConfig(),
41
+ engine_cfg: Optional[EngineConfig] = None,
42
42
  **kwargs: Any,
43
43
  ) -> OrientationPredictor:
44
44
  """Crop orientation classification architecture.
@@ -66,7 +66,7 @@ def crop_orientation_predictor(
66
66
  def page_orientation_predictor(
67
67
  arch: Any = "mobilenet_v3_small_page_orientation",
68
68
  load_in_8_bit: bool = False,
69
- engine_cfg: EngineConfig = EngineConfig(),
69
+ engine_cfg: Optional[EngineConfig] = None,
70
70
  **kwargs: Any,
71
71
  ) -> OrientationPredictor:
72
72
  """Page orientation classification architecture.
@@ -56,7 +56,7 @@ class DBNet(Engine):
56
56
  def __init__(
57
57
  self,
58
58
  model_path: str,
59
- engine_cfg: EngineConfig = EngineConfig(),
59
+ engine_cfg: Optional[EngineConfig] = None,
60
60
  bin_thresh: float = 0.3,
61
61
  box_thresh: float = 0.1,
62
62
  assume_straight_pages: bool = True,
@@ -93,7 +93,7 @@ def _dbnet(
93
93
  arch: str,
94
94
  model_path: str,
95
95
  load_in_8_bit: bool = False,
96
- engine_cfg: EngineConfig = EngineConfig(),
96
+ engine_cfg: Optional[EngineConfig] = None,
97
97
  **kwargs: Any,
98
98
  ) -> DBNet:
99
99
  # Patch the url
@@ -105,7 +105,7 @@ def _dbnet(
105
105
  def db_resnet34(
106
106
  model_path: str = default_cfgs["db_resnet34"]["url"],
107
107
  load_in_8_bit: bool = False,
108
- engine_cfg: EngineConfig = EngineConfig(),
108
+ engine_cfg: Optional[EngineConfig] = None,
109
109
  **kwargs: Any,
110
110
  ) -> DBNet:
111
111
  """DBNet as described in `"Real-time Scene Text Detection with Differentiable Binarization"
@@ -134,7 +134,7 @@ def db_resnet34(
134
134
  def db_resnet50(
135
135
  model_path: str = default_cfgs["db_resnet50"]["url"],
136
136
  load_in_8_bit: bool = False,
137
- engine_cfg: EngineConfig = EngineConfig(),
137
+ engine_cfg: Optional[EngineConfig] = None,
138
138
  **kwargs: Any,
139
139
  ) -> DBNet:
140
140
  """DBNet as described in `"Real-time Scene Text Detection with Differentiable Binarization"
@@ -163,7 +163,7 @@ def db_resnet50(
163
163
  def db_mobilenet_v3_large(
164
164
  model_path: str = default_cfgs["db_mobilenet_v3_large"]["url"],
165
165
  load_in_8_bit: bool = False,
166
- engine_cfg: EngineConfig = EngineConfig(),
166
+ engine_cfg: Optional[EngineConfig] = None,
167
167
  **kwargs: Any,
168
168
  ) -> DBNet:
169
169
  """DBNet as described in `"Real-time Scene Text Detection with Differentiable Binarization"
@@ -54,7 +54,7 @@ class FAST(Engine):
54
54
  def __init__(
55
55
  self,
56
56
  model_path: str,
57
- engine_cfg: EngineConfig = EngineConfig(),
57
+ engine_cfg: Optional[EngineConfig] = None,
58
58
  bin_thresh: float = 0.1,
59
59
  box_thresh: float = 0.1,
60
60
  assume_straight_pages: bool = True,
@@ -92,7 +92,7 @@ def _fast(
92
92
  arch: str,
93
93
  model_path: str,
94
94
  load_in_8_bit: bool = False,
95
- engine_cfg: EngineConfig = EngineConfig(),
95
+ engine_cfg: Optional[EngineConfig] = None,
96
96
  **kwargs: Any,
97
97
  ) -> FAST:
98
98
  if load_in_8_bit:
@@ -104,7 +104,7 @@ def _fast(
104
104
  def fast_tiny(
105
105
  model_path: str = default_cfgs["fast_tiny"]["url"],
106
106
  load_in_8_bit: bool = False,
107
- engine_cfg: EngineConfig = EngineConfig(),
107
+ engine_cfg: Optional[EngineConfig] = None,
108
108
  **kwargs: Any,
109
109
  ) -> FAST:
110
110
  """FAST as described in `"FAST: Faster Arbitrarily-Shaped Text Detector with Minimalist Kernel Representation"
@@ -133,7 +133,7 @@ def fast_tiny(
133
133
  def fast_small(
134
134
  model_path: str = default_cfgs["fast_small"]["url"],
135
135
  load_in_8_bit: bool = False,
136
- engine_cfg: EngineConfig = EngineConfig(),
136
+ engine_cfg: Optional[EngineConfig] = None,
137
137
  **kwargs: Any,
138
138
  ) -> FAST:
139
139
  """FAST as described in `"FAST: Faster Arbitrarily-Shaped Text Detector with Minimalist Kernel Representation"
@@ -162,7 +162,7 @@ def fast_small(
162
162
  def fast_base(
163
163
  model_path: str = default_cfgs["fast_base"]["url"],
164
164
  load_in_8_bit: bool = False,
165
- engine_cfg: EngineConfig = EngineConfig(),
165
+ engine_cfg: Optional[EngineConfig] = None,
166
166
  **kwargs: Any,
167
167
  ) -> FAST:
168
168
  """FAST as described in `"FAST: Faster Arbitrarily-Shaped Text Detector with Minimalist Kernel Representation"
@@ -56,7 +56,7 @@ class LinkNet(Engine):
56
56
  def __init__(
57
57
  self,
58
58
  model_path: str,
59
- engine_cfg: EngineConfig = EngineConfig(),
59
+ engine_cfg: Optional[EngineConfig] = None,
60
60
  bin_thresh: float = 0.1,
61
61
  box_thresh: float = 0.1,
62
62
  assume_straight_pages: bool = True,
@@ -94,7 +94,7 @@ def _linknet(
94
94
  arch: str,
95
95
  model_path: str,
96
96
  load_in_8_bit: bool = False,
97
- engine_cfg: EngineConfig = EngineConfig(),
97
+ engine_cfg: Optional[EngineConfig] = None,
98
98
  **kwargs: Any,
99
99
  ) -> LinkNet:
100
100
  # Patch the url
@@ -106,7 +106,7 @@ def _linknet(
106
106
  def linknet_resnet18(
107
107
  model_path: str = default_cfgs["linknet_resnet18"]["url"],
108
108
  load_in_8_bit: bool = False,
109
- engine_cfg: EngineConfig = EngineConfig(),
109
+ engine_cfg: Optional[EngineConfig] = None,
110
110
  **kwargs: Any,
111
111
  ) -> LinkNet:
112
112
  """LinkNet as described in `"LinkNet: Exploiting Encoder Representations for Efficient Semantic Segmentation"
@@ -135,7 +135,7 @@ def linknet_resnet18(
135
135
  def linknet_resnet34(
136
136
  model_path: str = default_cfgs["linknet_resnet34"]["url"],
137
137
  load_in_8_bit: bool = False,
138
- engine_cfg: EngineConfig = EngineConfig(),
138
+ engine_cfg: Optional[EngineConfig] = None,
139
139
  **kwargs: Any,
140
140
  ) -> LinkNet:
141
141
  """LinkNet as described in `"LinkNet: Exploiting Encoder Representations for Efficient Semantic Segmentation"
@@ -164,7 +164,7 @@ def linknet_resnet34(
164
164
  def linknet_resnet50(
165
165
  model_path: str = default_cfgs["linknet_resnet50"]["url"],
166
166
  load_in_8_bit: bool = False,
167
- engine_cfg: EngineConfig = EngineConfig(),
167
+ engine_cfg: Optional[EngineConfig] = None,
168
168
  **kwargs: Any,
169
169
  ) -> LinkNet:
170
170
  """LinkNet as described in `"LinkNet: Exploiting Encoder Representations for Efficient Semantic Segmentation"
@@ -3,7 +3,7 @@
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
- from typing import Any
6
+ from typing import Any, Optional
7
7
 
8
8
  from .. import detection
9
9
  from ..engine import EngineConfig
@@ -29,7 +29,7 @@ def _predictor(
29
29
  arch: Any,
30
30
  assume_straight_pages: bool = True,
31
31
  load_in_8_bit: bool = False,
32
- engine_cfg: EngineConfig = EngineConfig(),
32
+ engine_cfg: Optional[EngineConfig] = None,
33
33
  **kwargs: Any,
34
34
  ) -> DetectionPredictor:
35
35
  if isinstance(arch, str):
@@ -48,7 +48,7 @@ def _predictor(
48
48
 
49
49
  kwargs["mean"] = kwargs.get("mean", _model.cfg["mean"])
50
50
  kwargs["std"] = kwargs.get("std", _model.cfg["std"])
51
- kwargs["batch_size"] = kwargs.get("batch_size", 4)
51
+ kwargs["batch_size"] = kwargs.get("batch_size", 2)
52
52
  predictor = DetectionPredictor(
53
53
  PreProcessor(_model.cfg["input_shape"][1:], **kwargs),
54
54
  _model,
@@ -60,7 +60,7 @@ def detection_predictor(
60
60
  arch: Any = "fast_base",
61
61
  assume_straight_pages: bool = True,
62
62
  load_in_8_bit: bool = False,
63
- engine_cfg: EngineConfig = EngineConfig(),
63
+ engine_cfg: Optional[EngineConfig] = None,
64
64
  **kwargs: Any,
65
65
  ) -> DetectionPredictor:
66
66
  """Text detection architecture.
onnxtr/models/engine.py CHANGED
@@ -49,7 +49,7 @@ class EngineConfig:
49
49
  {
50
50
  "device_id": 0,
51
51
  "arena_extend_strategy": "kNextPowerOfTwo",
52
- "cudnn_conv_algo_search": "EXHAUSTIVE",
52
+ "cudnn_conv_algo_search": "DEFAULT",
53
53
  "do_copy_in_default_stream": True,
54
54
  },
55
55
  ),
@@ -87,8 +87,8 @@ class Engine:
87
87
  **kwargs: additional arguments to be passed to `download_from_url`
88
88
  """
89
89
 
90
- def __init__(self, url: str, engine_cfg: EngineConfig = EngineConfig(), **kwargs: Any) -> None:
91
- engine_cfg = engine_cfg or EngineConfig()
90
+ def __init__(self, url: str, engine_cfg: Optional[EngineConfig] = None, **kwargs: Any) -> None:
91
+ engine_cfg = engine_cfg if isinstance(engine_cfg, EngineConfig) else EngineConfig()
92
92
  archive_path = download_from_url(url, cache_subdir="models", **kwargs) if "http" in url else url
93
93
  self.session_options = engine_cfg.session_options
94
94
  self.providers = engine_cfg.providers
@@ -50,7 +50,7 @@ class _OCRPredictor:
50
50
  symmetric_pad: bool = True,
51
51
  detect_orientation: bool = False,
52
52
  load_in_8_bit: bool = False,
53
- clf_engine_cfg: EngineConfig = EngineConfig(),
53
+ clf_engine_cfg: Optional[EngineConfig] = None,
54
54
  **kwargs: Any,
55
55
  ) -> None:
56
56
  self.assume_straight_pages = assume_straight_pages
@@ -3,7 +3,7 @@
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
- from typing import Any, List
6
+ from typing import Any, List, Optional
7
7
 
8
8
  import numpy as np
9
9
 
@@ -52,7 +52,7 @@ class OCRPredictor(NestedObject, _OCRPredictor):
52
52
  symmetric_pad: bool = True,
53
53
  detect_orientation: bool = False,
54
54
  detect_language: bool = False,
55
- clf_engine_cfg: EngineConfig = EngineConfig(),
55
+ clf_engine_cfg: Optional[EngineConfig] = None,
56
56
  **kwargs: Any,
57
57
  ) -> None:
58
58
  self.det_predictor = det_predictor
@@ -67,11 +67,12 @@ class PreProcessor(NestedObject):
67
67
  if x.dtype not in (np.uint8, np.float32):
68
68
  raise TypeError("unsupported data type for numpy.ndarray")
69
69
  x = shape_translate(x, "HWC")
70
+
71
+ # Resizing
72
+ x = self.resize(x)
70
73
  # Data type & 255 division
71
74
  if x.dtype == np.uint8:
72
75
  x = x.astype(np.float32) / 255.0
73
- # Resizing
74
- x = self.resize(x)
75
76
 
76
77
  return x
77
78
 
@@ -95,13 +96,12 @@ class PreProcessor(NestedObject):
95
96
  raise TypeError("unsupported data type for numpy.ndarray")
96
97
  x = shape_translate(x, "BHWC")
97
98
 
98
- # Data type & 255 division
99
- if x.dtype == np.uint8:
100
- x = x.astype(np.float32) / 255.0
101
99
  # Resizing
102
100
  if (x.shape[1], x.shape[2]) != self.resize.output_size:
103
101
  x = np.array([self.resize(sample) for sample in x])
104
-
102
+ # Data type & 255 division
103
+ if x.dtype == np.uint8:
104
+ x = x.astype(np.float32) / 255.0
105
105
  batches = [x]
106
106
 
107
107
  elif isinstance(x, list) and all(isinstance(sample, np.ndarray) for sample in x):
@@ -124,7 +124,7 @@ class CRNN(Engine):
124
124
  self,
125
125
  model_path: str,
126
126
  vocab: str,
127
- engine_cfg: EngineConfig = EngineConfig(),
127
+ engine_cfg: Optional[EngineConfig] = None,
128
128
  cfg: Optional[Dict[str, Any]] = None,
129
129
  **kwargs: Any,
130
130
  ) -> None:
@@ -154,7 +154,7 @@ def _crnn(
154
154
  arch: str,
155
155
  model_path: str,
156
156
  load_in_8_bit: bool = False,
157
- engine_cfg: EngineConfig = EngineConfig(),
157
+ engine_cfg: Optional[EngineConfig] = None,
158
158
  **kwargs: Any,
159
159
  ) -> CRNN:
160
160
  kwargs["vocab"] = kwargs.get("vocab", default_cfgs[arch]["vocab"])
@@ -172,7 +172,7 @@ def _crnn(
172
172
  def crnn_vgg16_bn(
173
173
  model_path: str = default_cfgs["crnn_vgg16_bn"]["url"],
174
174
  load_in_8_bit: bool = False,
175
- engine_cfg: EngineConfig = EngineConfig(),
175
+ engine_cfg: Optional[EngineConfig] = None,
176
176
  **kwargs: Any,
177
177
  ) -> CRNN:
178
178
  """CRNN with a VGG-16 backbone as described in `"An End-to-End Trainable Neural Network for Image-based
@@ -201,7 +201,7 @@ def crnn_vgg16_bn(
201
201
  def crnn_mobilenet_v3_small(
202
202
  model_path: str = default_cfgs["crnn_mobilenet_v3_small"]["url"],
203
203
  load_in_8_bit: bool = False,
204
- engine_cfg: EngineConfig = EngineConfig(),
204
+ engine_cfg: Optional[EngineConfig] = None,
205
205
  **kwargs: Any,
206
206
  ) -> CRNN:
207
207
  """CRNN with a MobileNet V3 Small backbone as described in `"An End-to-End Trainable Neural Network for Image-based
@@ -230,7 +230,7 @@ def crnn_mobilenet_v3_small(
230
230
  def crnn_mobilenet_v3_large(
231
231
  model_path: str = default_cfgs["crnn_mobilenet_v3_large"]["url"],
232
232
  load_in_8_bit: bool = False,
233
- engine_cfg: EngineConfig = EngineConfig(),
233
+ engine_cfg: Optional[EngineConfig] = None,
234
234
  **kwargs: Any,
235
235
  ) -> CRNN:
236
236
  """CRNN with a MobileNet V3 Large backbone as described in `"An End-to-End Trainable Neural Network for Image-based
@@ -45,7 +45,7 @@ class MASTER(Engine):
45
45
  self,
46
46
  model_path: str,
47
47
  vocab: str,
48
- engine_cfg: EngineConfig = EngineConfig(),
48
+ engine_cfg: Optional[EngineConfig] = None,
49
49
  cfg: Optional[Dict[str, Any]] = None,
50
50
  **kwargs: Any,
51
51
  ) -> None:
@@ -116,7 +116,7 @@ def _master(
116
116
  arch: str,
117
117
  model_path: str,
118
118
  load_in_8_bit: bool = False,
119
- engine_cfg: EngineConfig = EngineConfig(),
119
+ engine_cfg: Optional[EngineConfig] = None,
120
120
  **kwargs: Any,
121
121
  ) -> MASTER:
122
122
  # Patch the config
@@ -134,7 +134,7 @@ def _master(
134
134
  def master(
135
135
  model_path: str = default_cfgs["master"]["url"],
136
136
  load_in_8_bit: bool = False,
137
- engine_cfg: EngineConfig = EngineConfig(),
137
+ engine_cfg: Optional[EngineConfig] = None,
138
138
  **kwargs: Any,
139
139
  ) -> MASTER:
140
140
  """MASTER as described in paper: <https://arxiv.org/pdf/1910.02562.pdf>`_.
@@ -44,7 +44,7 @@ class PARSeq(Engine):
44
44
  self,
45
45
  model_path: str,
46
46
  vocab: str,
47
- engine_cfg: EngineConfig = EngineConfig(),
47
+ engine_cfg: Optional[EngineConfig] = None,
48
48
  cfg: Optional[Dict[str, Any]] = None,
49
49
  **kwargs: Any,
50
50
  ) -> None:
@@ -104,7 +104,7 @@ def _parseq(
104
104
  arch: str,
105
105
  model_path: str,
106
106
  load_in_8_bit: bool = False,
107
- engine_cfg: EngineConfig = EngineConfig(),
107
+ engine_cfg: Optional[EngineConfig] = None,
108
108
  **kwargs: Any,
109
109
  ) -> PARSeq:
110
110
  # Patch the config
@@ -123,7 +123,7 @@ def _parseq(
123
123
  def parseq(
124
124
  model_path: str = default_cfgs["parseq"]["url"],
125
125
  load_in_8_bit: bool = False,
126
- engine_cfg: EngineConfig = EngineConfig(),
126
+ engine_cfg: Optional[EngineConfig] = None,
127
127
  **kwargs: Any,
128
128
  ) -> PARSeq:
129
129
  """PARSeq architecture from
@@ -44,7 +44,7 @@ class SAR(Engine):
44
44
  self,
45
45
  model_path: str,
46
46
  vocab: str,
47
- engine_cfg: EngineConfig = EngineConfig(),
47
+ engine_cfg: Optional[EngineConfig] = None,
48
48
  cfg: Optional[Dict[str, Any]] = None,
49
49
  **kwargs: Any,
50
50
  ) -> None:
@@ -103,7 +103,7 @@ def _sar(
103
103
  arch: str,
104
104
  model_path: str,
105
105
  load_in_8_bit: bool = False,
106
- engine_cfg: EngineConfig = EngineConfig(),
106
+ engine_cfg: Optional[EngineConfig] = None,
107
107
  **kwargs: Any,
108
108
  ) -> SAR:
109
109
  # Patch the config
@@ -122,7 +122,7 @@ def _sar(
122
122
  def sar_resnet31(
123
123
  model_path: str = default_cfgs["sar_resnet31"]["url"],
124
124
  load_in_8_bit: bool = False,
125
- engine_cfg: EngineConfig = EngineConfig(),
125
+ engine_cfg: Optional[EngineConfig] = None,
126
126
  **kwargs: Any,
127
127
  ) -> SAR:
128
128
  """SAR with a resnet-31 feature extractor as described in `"Show, Attend and Read:A Simple and Strong
@@ -52,7 +52,7 @@ class ViTSTR(Engine):
52
52
  self,
53
53
  model_path: str,
54
54
  vocab: str,
55
- engine_cfg: EngineConfig = EngineConfig(),
55
+ engine_cfg: Optional[EngineConfig] = None,
56
56
  cfg: Optional[Dict[str, Any]] = None,
57
57
  **kwargs: Any,
58
58
  ) -> None:
@@ -114,7 +114,7 @@ def _vitstr(
114
114
  arch: str,
115
115
  model_path: str,
116
116
  load_in_8_bit: bool = False,
117
- engine_cfg: EngineConfig = EngineConfig(),
117
+ engine_cfg: Optional[EngineConfig] = None,
118
118
  **kwargs: Any,
119
119
  ) -> ViTSTR:
120
120
  # Patch the config
@@ -133,7 +133,7 @@ def _vitstr(
133
133
  def vitstr_small(
134
134
  model_path: str = default_cfgs["vitstr_small"]["url"],
135
135
  load_in_8_bit: bool = False,
136
- engine_cfg: EngineConfig = EngineConfig(),
136
+ engine_cfg: Optional[EngineConfig] = None,
137
137
  **kwargs: Any,
138
138
  ) -> ViTSTR:
139
139
  """ViTSTR-Small as described in `"Vision Transformer for Fast and Efficient Scene Text Recognition"
@@ -162,7 +162,7 @@ def vitstr_small(
162
162
  def vitstr_base(
163
163
  model_path: str = default_cfgs["vitstr_base"]["url"],
164
164
  load_in_8_bit: bool = False,
165
- engine_cfg: EngineConfig = EngineConfig(),
165
+ engine_cfg: Optional[EngineConfig] = None,
166
166
  **kwargs: Any,
167
167
  ) -> ViTSTR:
168
168
  """ViTSTR-Base as described in `"Vision Transformer for Fast and Efficient Scene Text Recognition"
@@ -3,7 +3,7 @@
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
- from typing import Any, List
6
+ from typing import Any, List, Optional
7
7
 
8
8
  from .. import recognition
9
9
  from ..engine import EngineConfig
@@ -26,7 +26,7 @@ ARCHS: List[str] = [
26
26
 
27
27
 
28
28
  def _predictor(
29
- arch: Any, load_in_8_bit: bool = False, engine_cfg: EngineConfig = EngineConfig(), **kwargs: Any
29
+ arch: Any, load_in_8_bit: bool = False, engine_cfg: Optional[EngineConfig] = None, **kwargs: Any
30
30
  ) -> RecognitionPredictor:
31
31
  if isinstance(arch, str):
32
32
  if arch not in ARCHS:
@@ -50,7 +50,7 @@ def _predictor(
50
50
 
51
51
 
52
52
  def recognition_predictor(
53
- arch: Any = "crnn_vgg16_bn", load_in_8_bit: bool = False, engine_cfg: EngineConfig = EngineConfig(), **kwargs: Any
53
+ arch: Any = "crnn_vgg16_bn", load_in_8_bit: bool = False, engine_cfg: Optional[EngineConfig] = None, **kwargs: Any
54
54
  ) -> RecognitionPredictor:
55
55
  """Text recognition architecture.
56
56
 
onnxtr/models/zoo.py CHANGED
@@ -3,7 +3,7 @@
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
- from typing import Any
6
+ from typing import Any, Optional
7
7
 
8
8
  from .detection.zoo import detection_predictor
9
9
  from .engine import EngineConfig
@@ -19,15 +19,15 @@ def _predictor(
19
19
  assume_straight_pages: bool = True,
20
20
  preserve_aspect_ratio: bool = True,
21
21
  symmetric_pad: bool = True,
22
- det_bs: int = 4,
23
- reco_bs: int = 1024,
22
+ det_bs: int = 2,
23
+ reco_bs: int = 512,
24
24
  detect_orientation: bool = False,
25
25
  straighten_pages: bool = False,
26
26
  detect_language: bool = False,
27
27
  load_in_8_bit: bool = False,
28
- det_engine_cfg: EngineConfig = EngineConfig(),
29
- reco_engine_cfg: EngineConfig = EngineConfig(),
30
- clf_engine_cfg: EngineConfig = EngineConfig(),
28
+ det_engine_cfg: Optional[EngineConfig] = None,
29
+ reco_engine_cfg: Optional[EngineConfig] = None,
30
+ clf_engine_cfg: Optional[EngineConfig] = None,
31
31
  **kwargs,
32
32
  ) -> OCRPredictor:
33
33
  # Detection
@@ -74,9 +74,9 @@ def ocr_predictor(
74
74
  straighten_pages: bool = False,
75
75
  detect_language: bool = False,
76
76
  load_in_8_bit: bool = False,
77
- det_engine_cfg: EngineConfig = EngineConfig(),
78
- reco_engine_cfg: EngineConfig = EngineConfig(),
79
- clf_engine_cfg: EngineConfig = EngineConfig(),
77
+ det_engine_cfg: Optional[EngineConfig] = None,
78
+ reco_engine_cfg: Optional[EngineConfig] = None,
79
+ clf_engine_cfg: Optional[EngineConfig] = None,
80
80
  **kwargs: Any,
81
81
  ) -> OCRPredictor:
82
82
  """End-to-end OCR architecture using one model for localization, and another for text recognition.
onnxtr/transforms/base.py CHANGED
@@ -5,8 +5,8 @@
5
5
 
6
6
  from typing import Tuple, Union
7
7
 
8
- import cv2
9
8
  import numpy as np
9
+ from PIL import Image, ImageOps
10
10
 
11
11
  __all__ = ["Resize", "Normalize"]
12
12
 
@@ -17,64 +17,51 @@ class Resize:
17
17
  def __init__(
18
18
  self,
19
19
  size: Union[int, Tuple[int, int]],
20
- interpolation=cv2.INTER_LINEAR,
20
+ interpolation=Image.Resampling.BILINEAR,
21
21
  preserve_aspect_ratio: bool = False,
22
22
  symmetric_pad: bool = False,
23
23
  ) -> None:
24
- super().__init__()
25
- self.size = size
24
+ self.size = size if isinstance(size, tuple) else (size, size)
26
25
  self.interpolation = interpolation
27
26
  self.preserve_aspect_ratio = preserve_aspect_ratio
28
27
  self.symmetric_pad = symmetric_pad
29
28
  self.output_size = size if isinstance(size, tuple) else (size, size)
30
29
 
31
- if not isinstance(self.size, (int, tuple, list)):
32
- raise AssertionError("size should be either a tuple, a list or an int")
30
+ if not isinstance(self.size, (tuple, int)):
31
+ raise AssertionError("size should be either a tuple or an int")
33
32
 
34
- def __call__(
35
- self,
36
- img: np.ndarray,
37
- ) -> np.ndarray:
38
- if img.ndim == 3:
39
- h, w = img.shape[0:2]
40
- else:
41
- h, w = img.shape[1:3]
42
- sh, sw = self.size if isinstance(self.size, tuple) else (self.size, self.size)
33
+ def __call__(self, img: np.ndarray) -> np.ndarray:
34
+ img = (img * 255).astype(np.uint8) if img.dtype != np.uint8 else img
35
+ h, w = img.shape[:2] if img.ndim == 3 else img.shape[1:3]
36
+ sh, sw = self.size
43
37
 
44
- # Calculate aspect ratio of the image
45
- aspect = w / h
38
+ if not self.preserve_aspect_ratio:
39
+ return np.array(Image.fromarray(img).resize((sw, sh), resample=self.interpolation))
46
40
 
47
- # Compute scaling and padding sizes
48
- if self.preserve_aspect_ratio:
49
- if aspect > 1: # Horizontal image
50
- new_w = sw
51
- new_h = int(sw / aspect)
52
- elif aspect < 1: # Vertical image
53
- new_h = sh
54
- new_w = int(sh * aspect)
55
- else: # Square image
56
- new_h, new_w = sh, sw
57
-
58
- img_resized = cv2.resize(img, (new_w, new_h), interpolation=self.interpolation)
59
-
60
- # Calculate padding
61
- pad_top = max((sh - new_h) // 2, 0)
62
- pad_bottom = max(sh - new_h - pad_top, 0)
63
- pad_left = max((sw - new_w) // 2, 0)
64
- pad_right = max(sw - new_w - pad_left, 0)
65
-
66
- # Pad the image
67
- img_resized = cv2.copyMakeBorder( # type: ignore[call-overload]
68
- img_resized, pad_top, pad_bottom, pad_left, pad_right, borderType=cv2.BORDER_CONSTANT, value=0
69
- )
70
-
71
- # Ensure the image matches the target size by resizing it again if needed
72
- img_resized = cv2.resize(img_resized, (sw, sh), interpolation=self.interpolation)
41
+ actual_ratio = h / w
42
+ target_ratio = sh / sw
43
+
44
+ if target_ratio == actual_ratio:
45
+ return np.array(Image.fromarray(img).resize((sw, sh), resample=self.interpolation))
46
+
47
+ if actual_ratio > target_ratio:
48
+ tmp_size = (int(sh / actual_ratio), sh)
73
49
  else:
74
- # Resize the image without preserving aspect ratio
75
- img_resized = cv2.resize(img, (sw, sh), interpolation=self.interpolation)
50
+ tmp_size = (sw, int(sw * actual_ratio))
51
+
52
+ img_resized = Image.fromarray(img).resize(tmp_size, resample=self.interpolation)
53
+ pad_left = pad_top = 0
54
+ pad_right = sw - img_resized.width
55
+ pad_bottom = sh - img_resized.height
56
+
57
+ if self.symmetric_pad:
58
+ pad_left = pad_right // 2
59
+ pad_right -= pad_left
60
+ pad_top = pad_bottom // 2
61
+ pad_bottom -= pad_top
76
62
 
77
- return img_resized
63
+ img_resized = ImageOps.expand(img_resized, (pad_left, pad_top, pad_right, pad_bottom))
64
+ return np.array(img_resized)
78
65
 
79
66
  def __repr__(self) -> str:
80
67
  interpolate_str = self.interpolation
onnxtr/utils/fonts.py CHANGED
@@ -5,14 +5,16 @@
5
5
 
6
6
  import logging
7
7
  import platform
8
- from typing import Optional
8
+ from typing import Optional, Union
9
9
 
10
10
  from PIL import ImageFont
11
11
 
12
12
  __all__ = ["get_font"]
13
13
 
14
14
 
15
- def get_font(font_family: Optional[str] = None, font_size: int = 13) -> ImageFont.ImageFont:
15
+ def get_font(
16
+ font_family: Optional[str] = None, font_size: int = 13
17
+ ) -> Union[ImageFont.FreeTypeFont, ImageFont.ImageFont]:
16
18
  """Resolves a compatible ImageFont for the system
17
19
 
18
20
  Args:
@@ -29,7 +31,7 @@ def get_font(font_family: Optional[str] = None, font_size: int = 13) -> ImageFon
29
31
  try:
30
32
  font = ImageFont.truetype("FreeMono.ttf" if platform.system() == "Linux" else "Arial.ttf", font_size)
31
33
  except OSError: # pragma: no cover
32
- font = ImageFont.load_default()
34
+ font = ImageFont.load_default() # type: ignore[assignment]
33
35
  logging.warning(
34
36
  "unable to load recommended font family. Loading default PIL font,"
35
37
  "font size issues may be expected."
onnxtr/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = 'v0.3.0'
1
+ __version__ = 'v0.3.2'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: onnxtr
3
- Version: 0.3.0
3
+ Version: 0.3.2
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
@@ -275,7 +275,7 @@ Requires-Dist: mplcursors >=0.3 ; extra == 'viz'
275
275
  [![codecov](https://codecov.io/gh/felixdittrich92/OnnxTR/graph/badge.svg?token=WVFRCQBOLI)](https://codecov.io/gh/felixdittrich92/OnnxTR)
276
276
  [![Codacy Badge](https://app.codacy.com/project/badge/Grade/4fff4d764bb14fb8b4f4afeb9587231b)](https://app.codacy.com/gh/felixdittrich92/OnnxTR/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
277
277
  [![CodeFactor](https://www.codefactor.io/repository/github/felixdittrich92/onnxtr/badge)](https://www.codefactor.io/repository/github/felixdittrich92/onnxtr)
278
- [![Pypi](https://img.shields.io/badge/pypi-v0.3.0-blue.svg)](https://pypi.org/project/OnnxTR/)
278
+ [![Pypi](https://img.shields.io/badge/pypi-v0.3.1-blue.svg)](https://pypi.org/project/OnnxTR/)
279
279
 
280
280
  > :warning: Please note that this is a wrapper around the [doctr](https://github.com/mindee/doctr) library to provide a Onnx pipeline for docTR. For feature requests, which are not directly related to the Onnx pipeline, please refer to the base project.
281
281
 
@@ -345,8 +345,8 @@ from onnxtr.models import ocr_predictor, EngineConfig
345
345
  model = ocr_predictor(
346
346
  det_arch='fast_base', # detection architecture
347
347
  reco_arch='vitstr_base', # recognition architecture
348
- det_bs=4, # detection batch size
349
- reco_bs=1024, # recognition batch size
348
+ det_bs=2, # detection batch size
349
+ reco_bs=512, # recognition batch size
350
350
  assume_straight_pages=True, # set to `False` if the pages are not straight (rotation, perspective, etc.) (default: True)
351
351
  straighten_pages=False, # set to `True` if the pages should be straightened before final processing (default: False)
352
352
  # Preprocessing related parameters
@@ -419,7 +419,7 @@ general_options.enable_cpu_mem_arena = False
419
419
  # NOTE: The following would force to run only on the GPU if no GPU is available it will raise an error
420
420
  # List of strings e.g. ["CUDAExecutionProvider", "CPUExecutionProvider"] or a list of tuples with the provider and its options e.g.
421
421
  # [("CUDAExecutionProvider", {"device_id": 0}), ("CPUExecutionProvider", {"arena_extend_strategy": "kSameAsRequested"})]
422
- providers = [("CUDAExecutionProvider", {"device_id": 0})] # For available providers see: https://onnxruntime.ai/docs/execution-providers/
422
+ providers = [("CUDAExecutionProvider", {"device_id": 0, "cudnn_conv_algo_search": "DEFAULT"})] # For available providers see: https://onnxruntime.ai/docs/execution-providers/
423
423
 
424
424
  engine_config = EngineConfig(
425
425
  session_options=general_options,
@@ -451,7 +451,7 @@ model = ocr_predictor(det_arch=det_model, reco_arch=reco_model)
451
451
 
452
452
  ## Models architectures
453
453
 
454
- Credits where it's due: this repository is implementing, among others, architectures from published research papers.
454
+ Credits where it's due: this repository provides ONNX models for the following architectures, converted from the docTR models:
455
455
 
456
456
  ### Text Detection
457
457
 
@@ -1,10 +1,10 @@
1
1
  onnxtr/__init__.py,sha256=h7Wc2tuHLsaoCk5xNpEFEK-g11A6SJA7nAasA76TQ_Y,100
2
2
  onnxtr/file_utils.py,sha256=WjUKalEdR53aoeIY4e-ihy3r7J_C9qFxL40JHGPfutc,1107
3
3
  onnxtr/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- onnxtr/version.py,sha256=3WzdRDDiKxM8JAvNhW3PVopgIZrHCvYuR4insIGe4bU,23
4
+ onnxtr/version.py,sha256=Mqv-IS8XNTfhjRfomiPmqTyHtOUKl9tLeE2KEmYIkeM,23
5
5
  onnxtr/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  onnxtr/contrib/artefacts.py,sha256=tdmfhvfXVRYEH7uj4_hqf2cuUGoTieyNK8bXsD3zHwo,5383
7
- onnxtr/contrib/base.py,sha256=PoCKtOIgj7u4xl-V0eBVh-QmVeTyk_eEggFHQ8R34AI,3445
7
+ onnxtr/contrib/base.py,sha256=KyJ8_zDSKEWSFBszgCbLjEeI7SKg4N_iH_ZQNf90SWQ,3288
8
8
  onnxtr/io/__init__.py,sha256=kS7tKGFvzxOCWBOun-Y8n9CsziwRKNynjwpZEUUI03M,106
9
9
  onnxtr/io/elements.py,sha256=h-IxpFqXrvg-fOhpnOqpGFLdG-lR-xYYIxk3chy_MN8,17769
10
10
  onnxtr/io/html.py,sha256=Em_7PjZ56SugJ9bjjcWLCMVe5ee6uUMKeZovNxJFAXw,737
@@ -14,60 +14,60 @@ onnxtr/io/reader.py,sha256=BA7DPhW-Gkmce_ZfzrOl4H3pSXVy2JBeQEuY3pWrBFg,2852
14
14
  onnxtr/models/__init__.py,sha256=Rg-5P2e622q-5ScfxVE3G8GXa51HUPS7b0jkvdukFzM,134
15
15
  onnxtr/models/_utils.py,sha256=KncsNcoWqbsxFwduce2STuGHLhv63nXEHv7CMuh6wYA,6606
16
16
  onnxtr/models/builder.py,sha256=Bzg-XHZc5k16Ti2XeV9hm4POTHofe581Azq1a3d1O6E,14296
17
- onnxtr/models/engine.py,sha256=SOK-KTNWMozIjErWQAY56iB2eXyRD44Q08TdL9YOVAY,4717
18
- onnxtr/models/zoo.py,sha256=MJIT3OZ4kyj2xBfQdCVxl2uBdiLCnnv8czPtHbZl5e4,5343
17
+ onnxtr/models/engine.py,sha256=fPpQzX_wNoxkPcECbGHFoIYtphHVQD9YkJG9hXFu42E,4756
18
+ onnxtr/models/zoo.py,sha256=Zcx0mOfMwUR2YAMd7ug06RvXeG2T1PzR2twS6y9X19A,5352
19
19
  onnxtr/models/classification/__init__.py,sha256=h1bZs55iLJBMATtzS4ntTKwfD6OGXBiiqGv_hEnOFnE,41
20
- onnxtr/models/classification/zoo.py,sha256=1oaKfW646IVa-MmLqGi58BtBWdHdu4hI8r79wVdLQ2o,3426
20
+ onnxtr/models/classification/zoo.py,sha256=jzZMf7hKqN9omGAPHJR83rVDaaWhPm-Rk55Xn4bGaIs,3436
21
21
  onnxtr/models/classification/models/__init__.py,sha256=rohbM6ZQslfYchi7feZwwh-sX3XXRUhgtEJQeurAytQ,24
22
- onnxtr/models/classification/models/mobilenet.py,sha256=vTBHhA1okhnCgn36qKlM2eDCm4ftFZDH8Bk2VpkWm4U,4880
22
+ onnxtr/models/classification/models/mobilenet.py,sha256=_hWUfQfjSLDPT2v_Ru6KcNZYMRTSPBlFpOdgGeE2jD0,4880
23
23
  onnxtr/models/classification/predictor/__init__.py,sha256=ERmmOxz_9mUkIuccNbzUa5Y6gVLLVDdyc4cCxbCCUbY,20
24
24
  onnxtr/models/classification/predictor/base.py,sha256=Xfaj2XlaJuQ2R81XqF5RB0Wcvzd4wh7Z6j1ifn2niFc,2097
25
25
  onnxtr/models/detection/__init__.py,sha256=h1bZs55iLJBMATtzS4ntTKwfD6OGXBiiqGv_hEnOFnE,41
26
26
  onnxtr/models/detection/core.py,sha256=ZmVDHLJ1l4LQ8rFSKc7enXDkGcOWrcQv4H0SJWyLsag,3584
27
- onnxtr/models/detection/zoo.py,sha256=dpxLC7jMNZyl3a-o4dSCwsMnqtgoRwxy4psZ8WPC6cE,2725
27
+ onnxtr/models/detection/zoo.py,sha256=5kz4l67Xkr4YTDoI2wDTiI6HSaB926zfua0SZU-Kaw8,2735
28
28
  onnxtr/models/detection/_utils/__init__.py,sha256=oPkIYbySSbLsOk02wVPNO9bUuywC47YjaenfyTwfOsw,20
29
29
  onnxtr/models/detection/_utils/base.py,sha256=fOWnvBKluWKTNXSBKg3U6ckzYuF7onEKQ4AvheuTJQk,2346
30
30
  onnxtr/models/detection/models/__init__.py,sha256=6Ea6knYrVCR2jAmPlsVWmCdHe-c6lSRETSAuZGfhx8I,85
31
- onnxtr/models/detection/models/differentiable_binarization.py,sha256=o6Y0iDRHxArLqBE-EKz3Ru9l6L7sqHmHkNny60-gV4Q,6734
32
- onnxtr/models/detection/models/fast.py,sha256=YUnbKLIZdeMd-lfFyWEtRbxpiXsRBizLb0VpcruJD-U,6293
33
- onnxtr/models/detection/models/linknet.py,sha256=aXOZ6ieczvAoJQcVuVpJZVXqfEIL4OHr5NqQ5nEI2QY,6771
31
+ onnxtr/models/detection/models/differentiable_binarization.py,sha256=5ZeO3RRFMvLLZ4TpK01xUdxTTFhXvywjrNBbjASxgLY,6734
32
+ onnxtr/models/detection/models/fast.py,sha256=2umsWdwPV91q6PyNrlZPbdi9DIk7dbmZWcLOMkD1EUg,6293
33
+ onnxtr/models/detection/models/linknet.py,sha256=Wd4PbKMJlOZ20fXrZcqPYtdGETSKGXYAKEqBVrVWHEE,6771
34
34
  onnxtr/models/detection/postprocessor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
35
  onnxtr/models/detection/postprocessor/base.py,sha256=FIhSNktNLQjGWup3xEMaOCjKQmRvtt0h8M9IFQk_5jM,5823
36
36
  onnxtr/models/detection/predictor/__init__.py,sha256=ERmmOxz_9mUkIuccNbzUa5Y6gVLLVDdyc4cCxbCCUbY,20
37
37
  onnxtr/models/detection/predictor/base.py,sha256=bt8M6I14tWC9DYjrFrqg-AU5u670_uPpuC7LmcegcCQ,2328
38
38
  onnxtr/models/predictor/__init__.py,sha256=XL25XkRkgyK7mldF-CWhg2MMakSdP5vLpDLwL59hphk,25
39
- onnxtr/models/predictor/base.py,sha256=wROvnIvMQb_SPPX8m8_RmBSqZqIDlH7Vfo81D8teQQA,8860
40
- onnxtr/models/predictor/predictor.py,sha256=kmU6hj89k1QvFpljr3JEWneT7X5RQLcUNn3Ecbb1jm8,6237
39
+ onnxtr/models/predictor/base.py,sha256=VUs1OIsb8FW91U1ehB1sBaxG4Suz8iS-Ut50Zt6_SHo,8860
40
+ onnxtr/models/predictor/predictor.py,sha256=etxgAvT8cYhboPyHiDRO0BL1rBoTw5lL1vhZP4dHWqw,6247
41
41
  onnxtr/models/preprocessor/__init__.py,sha256=ERmmOxz_9mUkIuccNbzUa5Y6gVLLVDdyc4cCxbCCUbY,20
42
- onnxtr/models/preprocessor/base.py,sha256=f0t0rMCzvuxwgq7jlKvcVWyjeDOx7yCLUw52quEaETM,3990
42
+ onnxtr/models/preprocessor/base.py,sha256=8ZCKsB-o9uRaUm0x4x9FYpYxLXpwHyq2nVv_TlRgaMw,3990
43
43
  onnxtr/models/recognition/__init__.py,sha256=h1bZs55iLJBMATtzS4ntTKwfD6OGXBiiqGv_hEnOFnE,41
44
44
  onnxtr/models/recognition/core.py,sha256=0Q1dVXqRcDUr_ycT5tpoSH9-zuDF58GtnmxWpUS8Ibo,739
45
45
  onnxtr/models/recognition/utils.py,sha256=04abbjx-_OuF5iEANWIAOK3tQQl1tExPmBQx4IG04Lc,3569
46
- onnxtr/models/recognition/zoo.py,sha256=F0hiymT8Tfv115u_34PvmD8rpXw1fPinYno1DE9a8bo,2511
46
+ onnxtr/models/recognition/zoo.py,sha256=144aDgOpieatiVB0FO-otCNOAKS13AedLk7PWt4Z02M,2521
47
47
  onnxtr/models/recognition/models/__init__.py,sha256=IXfiuzzkft8O1CpBZWYTpFw19y49mt5rJ_iGSdaWiU0,105
48
- onnxtr/models/recognition/models/crnn.py,sha256=Ki2DeIQahvIJterFs2RYf-y21LFmFVuhmoem3-nVlXQ,8963
49
- onnxtr/models/recognition/models/master.py,sha256=VgPwyCpVv6UmTDaeeeGWWgcKPKeEq6Osif-Tq97xmj8,4777
50
- onnxtr/models/recognition/models/parseq.py,sha256=Ig0Tu31KgVEVWOX630VhEV2hoi5QtABxBrTsgiguK74,4577
51
- onnxtr/models/recognition/models/sar.py,sha256=OTyXC5_0-DPghHG9zY4ZCnFqAIf-3eBlWoRQOTfjZTc,4588
52
- onnxtr/models/recognition/models/vitstr.py,sha256=xED7mK1b2d3dUJkLjiFn1JQKe_CU0JE7fhPnEVilT7s,6054
48
+ onnxtr/models/recognition/models/crnn.py,sha256=JyQ43NEiWj2Vzd8z1oVv_G66xn59ClZ63njowQaAs0g,8963
49
+ onnxtr/models/recognition/models/master.py,sha256=-xnNM-5DPnbOH9b9mXPwU2Nknq7h1H0GXsdd2NWHFnM,4777
50
+ onnxtr/models/recognition/models/parseq.py,sha256=1n3Qvif2763h7H7B2BKovHiFpgan4-bXMntc1O8XuPE,4577
51
+ onnxtr/models/recognition/models/sar.py,sha256=Mc8axoyJaAlbdindvLLeOQCLp_p_m5kMZ9XHKzupo_E,4588
52
+ onnxtr/models/recognition/models/vitstr.py,sha256=mrLpGUS2mrsjCfWdwbMkWgZagTURKSr0qS8JrwFTJzs,6054
53
53
  onnxtr/models/recognition/predictor/__init__.py,sha256=ERmmOxz_9mUkIuccNbzUa5Y6gVLLVDdyc4cCxbCCUbY,20
54
54
  onnxtr/models/recognition/predictor/_utils.py,sha256=ZNm5I7ibiWfTlz302uiifCkUOu65YWa-oUBUMPrrUuQ,3406
55
55
  onnxtr/models/recognition/predictor/base.py,sha256=YvqSNEM3rCEttxl6hsC9zl1R97N9zO2WZfD5_-nfkR0,2483
56
56
  onnxtr/transforms/__init__.py,sha256=ERmmOxz_9mUkIuccNbzUa5Y6gVLLVDdyc4cCxbCCUbY,20
57
- onnxtr/transforms/base.py,sha256=KohBfq5qNkw9aznZtlGlphNlfKSRBhm5An6TcUiFA7M,3965
57
+ onnxtr/transforms/base.py,sha256=sVQIIQLzPRl0Uc6OyDGrJ4H_f6CMune5j0C9VVRAV0s,3577
58
58
  onnxtr/utils/__init__.py,sha256=pESRJKtcQyjRxiMgZPhtPYeLbCj-YSGyMVRHTbcMONU,94
59
59
  onnxtr/utils/common_types.py,sha256=eC_NyIwbo9qVF33LiNPqHKfyabWq9mYEKD9gAloo5UU,601
60
60
  onnxtr/utils/data.py,sha256=Dh0mgeHJhyPwmm63J90uDVmIYbrp63hh1_SnYLnpgJI,4354
61
- onnxtr/utils/fonts.py,sha256=OiOHFwkjN4L7QBrzMi7Ex7qj_KcTEJ1sHEJWSfiGNZU,1281
61
+ onnxtr/utils/fonts.py,sha256=27v0cojgUrVxNF8Krb1FybSoykoxFy1XjG8lHRUuiEY,1353
62
62
  onnxtr/utils/geometry.py,sha256=u9ei6WW8Yd29rtwnrDYercAY-tWkOLkzBd5Oi6NNyDI,17774
63
63
  onnxtr/utils/multithreading.py,sha256=30T7AylM3rb52ZEI3Pk1pfB0VYraTbc7yO2vNODVVFY,2011
64
64
  onnxtr/utils/reconstitution.py,sha256=Hx1_ddLevKLzuxXc19UelPdsGlAwqi4f6vRSYKHDUB4,2617
65
65
  onnxtr/utils/repr.py,sha256=kfbjGL6KymGT8spo2UL4FJXZ0XRwa7CO7Y1dTVR8dIk,2129
66
66
  onnxtr/utils/visualization.py,sha256=CX09qvDnNIw3BFW5F3jM4R9OcpLWAeZyoDyTAOGRvls,9925
67
67
  onnxtr/utils/vocabs.py,sha256=SCQ4XQjbHSxunj1tg2iHRiPfE8OaTAMhcJbKq5BNvFs,3138
68
- onnxtr-0.3.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
69
- onnxtr-0.3.0.dist-info/METADATA,sha256=0cPAKQr-w-WHimev0v9mtys9NetS_oYHZHTslgcSNu4,29756
70
- onnxtr-0.3.0.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
71
- onnxtr-0.3.0.dist-info/top_level.txt,sha256=r_MSUTpspp4pWEEWvly-s7ZkfCg1KwrK6-kBlXkWKU8,7
72
- onnxtr-0.3.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
73
- onnxtr-0.3.0.dist-info/RECORD,,
68
+ onnxtr-0.3.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
69
+ onnxtr-0.3.2.dist-info/METADATA,sha256=I9n5apYunvpxpSy36h-UtfNYl8eW3WOLpnPujaKUzgo,29802
70
+ onnxtr-0.3.2.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
71
+ onnxtr-0.3.2.dist-info/top_level.txt,sha256=r_MSUTpspp4pWEEWvly-s7ZkfCg1KwrK6-kBlXkWKU8,7
72
+ onnxtr-0.3.2.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
73
+ onnxtr-0.3.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.1.1)
2
+ Generator: setuptools (70.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5