onnx2tf 1.26.4__py3-none-any.whl → 1.26.6__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.
- onnx2tf/__init__.py +1 -1
- onnx2tf/onnx2tf.py +21 -0
- onnx2tf/ops/NonMaxSuppression.py +55 -27
- {onnx2tf-1.26.4.dist-info → onnx2tf-1.26.6.dist-info}/METADATA +17 -3
- {onnx2tf-1.26.4.dist-info → onnx2tf-1.26.6.dist-info}/RECORD +10 -10
- {onnx2tf-1.26.4.dist-info → onnx2tf-1.26.6.dist-info}/LICENSE +0 -0
- {onnx2tf-1.26.4.dist-info → onnx2tf-1.26.6.dist-info}/LICENSE_onnx-tensorflow +0 -0
- {onnx2tf-1.26.4.dist-info → onnx2tf-1.26.6.dist-info}/WHEEL +0 -0
- {onnx2tf-1.26.4.dist-info → onnx2tf-1.26.6.dist-info}/entry_points.txt +0 -0
- {onnx2tf-1.26.4.dist-info → onnx2tf-1.26.6.dist-info}/top_level.txt +0 -0
onnx2tf/__init__.py
CHANGED
onnx2tf/onnx2tf.py
CHANGED
|
@@ -80,6 +80,7 @@ def convert(
|
|
|
80
80
|
overwrite_input_shape: Optional[List[str]] = None,
|
|
81
81
|
no_large_tensor: Optional[bool] = False,
|
|
82
82
|
output_nms_with_dynamic_tensor: Optional[bool] = False,
|
|
83
|
+
switch_nms_version: Optional[str] = 'v4',
|
|
83
84
|
keep_ncw_or_nchw_or_ncdhw_input_names: Optional[List[str]] = None,
|
|
84
85
|
keep_nwc_or_nhwc_or_ndhwc_input_names: Optional[List[str]] = None,
|
|
85
86
|
keep_shape_absolutely_input_names: Optional[List[str]] = None,
|
|
@@ -270,6 +271,12 @@ def convert(
|
|
|
270
271
|
enable --output_nms_with_dynamic_tensor:\n
|
|
271
272
|
output_tensor_shape: [N, 7]
|
|
272
273
|
|
|
274
|
+
switch_nms_version: Optional[str]
|
|
275
|
+
Switch the NMS version to V4 or V5 to convert.\n\n
|
|
276
|
+
e.g.\n
|
|
277
|
+
NonMaxSuppressionV4(default): --switch_nms_version v4\n
|
|
278
|
+
NonMaxSuppressionV5: --switch_nms_version v5
|
|
279
|
+
|
|
273
280
|
keep_ncw_or_nchw_or_ncdhw_input_names: Optional[List[str]]
|
|
274
281
|
Holds the NCW or NCHW or NCDHW of the input shape for the specified INPUT OP names.\n
|
|
275
282
|
If a nonexistent INPUT OP name is specified, it is ignored.\n
|
|
@@ -921,6 +928,7 @@ def convert(
|
|
|
921
928
|
'mvn_epsilon': mvn_epsilon,
|
|
922
929
|
'output_signaturedefs': output_signaturedefs,
|
|
923
930
|
'output_nms_with_dynamic_tensor': output_nms_with_dynamic_tensor,
|
|
931
|
+
'switch_nms_version': switch_nms_version,
|
|
924
932
|
'output_integer_quantized_tflite': output_integer_quantized_tflite,
|
|
925
933
|
'gelu_replace_op_names': {},
|
|
926
934
|
'space_to_depth_replace_op_names': {},
|
|
@@ -2233,6 +2241,18 @@ def main():
|
|
|
2233
2241
|
'enable --output_nms_with_dynamic_tensor: \n' +
|
|
2234
2242
|
' output_tensor_shape: [N, 7]'
|
|
2235
2243
|
)
|
|
2244
|
+
parser.add_argument(
|
|
2245
|
+
'-snms',
|
|
2246
|
+
'--switch_nms_version',
|
|
2247
|
+
type=str,
|
|
2248
|
+
choices=['v4', 'v5'],
|
|
2249
|
+
default='v4',
|
|
2250
|
+
help=\
|
|
2251
|
+
'Switch the NMS version to V4 or V5 to convert. \n' +
|
|
2252
|
+
'e.g. \n' +
|
|
2253
|
+
'NonMaxSuppressionV4(default): --switch_nms_version v4 \n' +
|
|
2254
|
+
'NonMaxSuppressionV5: --switch_nms_version v5'
|
|
2255
|
+
)
|
|
2236
2256
|
parser.add_argument(
|
|
2237
2257
|
'-k',
|
|
2238
2258
|
'--keep_ncw_or_nchw_or_ncdhw_input_names',
|
|
@@ -2623,6 +2643,7 @@ def main():
|
|
|
2623
2643
|
overwrite_input_shape=args.overwrite_input_shape,
|
|
2624
2644
|
no_large_tensor=args.no_large_tensor,
|
|
2625
2645
|
output_nms_with_dynamic_tensor=args.output_nms_with_dynamic_tensor,
|
|
2646
|
+
switch_nms_version=args.switch_nms_version,
|
|
2626
2647
|
keep_ncw_or_nchw_or_ncdhw_input_names=args.keep_ncw_or_nchw_or_ncdhw_input_names,
|
|
2627
2648
|
keep_nwc_or_nhwc_or_ndhwc_input_names=args.keep_nwc_or_nhwc_or_ndhwc_input_names,
|
|
2628
2649
|
keep_shape_absolutely_input_names=args.keep_shape_absolutely_input_names,
|
onnx2tf/ops/NonMaxSuppression.py
CHANGED
|
@@ -25,8 +25,9 @@ from tensorflow.python.util import dispatch
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
class NMSLayer(tf_keras.layers.Layer):
|
|
28
|
-
def __init__(self):
|
|
28
|
+
def __init__(self, switch_nms_version='v4'):
|
|
29
29
|
super(NMSLayer, self).__init__()
|
|
30
|
+
self.switch_nms_version = switch_nms_version
|
|
30
31
|
|
|
31
32
|
@dispatch.add_dispatch_support
|
|
32
33
|
def non_max_suppression(
|
|
@@ -40,29 +41,56 @@ class NMSLayer(tf_keras.layers.Layer):
|
|
|
40
41
|
name=None,
|
|
41
42
|
):
|
|
42
43
|
with ops.name_scope(name, 'non_max_suppression'):
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
44
|
+
if self.switch_nms_version == 'v4':
|
|
45
|
+
selected_indices, num_valid = gen_image_ops.non_max_suppression_v4(
|
|
46
|
+
boxes=boxes,
|
|
47
|
+
scores=scores,
|
|
48
|
+
max_output_size=max_output_size \
|
|
49
|
+
if not isinstance(max_output_size, np.ndarray) \
|
|
50
|
+
else tf.convert_to_tensor(
|
|
51
|
+
value=max_output_size,
|
|
52
|
+
name='max_output_size'
|
|
53
|
+
),
|
|
54
|
+
iou_threshold=iou_threshold \
|
|
55
|
+
if not isinstance(iou_threshold, np.ndarray) \
|
|
56
|
+
else tf.convert_to_tensor(
|
|
57
|
+
value=iou_threshold,
|
|
58
|
+
name='iou_threshold',
|
|
59
|
+
),
|
|
60
|
+
score_threshold=score_threshold \
|
|
61
|
+
if not isinstance(score_threshold, np.ndarray) \
|
|
62
|
+
else tf.convert_to_tensor(
|
|
63
|
+
value=score_threshold,
|
|
64
|
+
name='score_threshold',
|
|
65
|
+
),
|
|
66
|
+
pad_to_max_output_size=pad_to_max_output_size,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
elif self.switch_nms_version == 'v5':
|
|
70
|
+
selected_indices, selected_scores, num_valid = gen_image_ops.non_max_suppression_v5(
|
|
71
|
+
boxes=boxes,
|
|
72
|
+
scores=scores,
|
|
73
|
+
max_output_size=max_output_size \
|
|
74
|
+
if not isinstance(max_output_size, np.ndarray) \
|
|
75
|
+
else tf.convert_to_tensor(
|
|
76
|
+
value=max_output_size,
|
|
77
|
+
name='max_output_size'
|
|
78
|
+
),
|
|
79
|
+
iou_threshold=iou_threshold \
|
|
80
|
+
if not isinstance(iou_threshold, np.ndarray) \
|
|
81
|
+
else tf.convert_to_tensor(
|
|
82
|
+
value=iou_threshold,
|
|
83
|
+
name='iou_threshold',
|
|
84
|
+
),
|
|
85
|
+
score_threshold=score_threshold \
|
|
86
|
+
if not isinstance(score_threshold, np.ndarray) \
|
|
87
|
+
else tf.convert_to_tensor(
|
|
88
|
+
value=score_threshold,
|
|
89
|
+
name='score_threshold',
|
|
90
|
+
),
|
|
91
|
+
soft_nms_sigma=0.0,
|
|
92
|
+
pad_to_max_output_size=pad_to_max_output_size,
|
|
93
|
+
)
|
|
66
94
|
if pad_to_max_output_size:
|
|
67
95
|
return selected_indices
|
|
68
96
|
|
|
@@ -130,8 +158,8 @@ def make_node(
|
|
|
130
158
|
scores = tf_layers_dict[graph_node_input_2.name]['tf_node'] \
|
|
131
159
|
if isinstance(graph_node_input_2, gs.Variable) else graph_node_input_2
|
|
132
160
|
|
|
133
|
-
output_nms_with_dynamic_tensor: bool =
|
|
134
|
-
|
|
161
|
+
output_nms_with_dynamic_tensor: bool = kwargs['output_nms_with_dynamic_tensor']
|
|
162
|
+
switch_nms_version: str = kwargs['switch_nms_version']
|
|
135
163
|
|
|
136
164
|
# Pre-process transpose
|
|
137
165
|
boxes = pre_process_transpose(
|
|
@@ -339,7 +367,7 @@ def make_node(
|
|
|
339
367
|
axis=0,
|
|
340
368
|
)
|
|
341
369
|
# get the selected boxes indices
|
|
342
|
-
nms = NMSLayer()
|
|
370
|
+
nms = NMSLayer(switch_nms_version=switch_nms_version)
|
|
343
371
|
selected_indices = nms(
|
|
344
372
|
boxes=tf_boxes,
|
|
345
373
|
scores=tf_scores,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: onnx2tf
|
|
3
|
-
Version: 1.26.
|
|
3
|
+
Version: 1.26.6
|
|
4
4
|
Summary: Self-Created Tools to convert ONNX files (NCHW) to TensorFlow/TFLite/Keras format (NHWC). The purpose of this tool is to solve the massive Transpose extrapolation problem in onnx-tensorflow (onnx-tf).
|
|
5
5
|
Home-page: https://github.com/PINTO0309/onnx2tf
|
|
6
6
|
Author: Katsuya Hyodo
|
|
@@ -323,7 +323,7 @@ Video speed is adjusted approximately 50 times slower than actual speed.
|
|
|
323
323
|
docker run --rm -it \
|
|
324
324
|
-v `pwd`:/workdir \
|
|
325
325
|
-w /workdir \
|
|
326
|
-
ghcr.io/pinto0309/onnx2tf:1.26.
|
|
326
|
+
ghcr.io/pinto0309/onnx2tf:1.26.6
|
|
327
327
|
|
|
328
328
|
or
|
|
329
329
|
|
|
@@ -331,7 +331,7 @@ Video speed is adjusted approximately 50 times slower than actual speed.
|
|
|
331
331
|
docker run --rm -it \
|
|
332
332
|
-v `pwd`:/workdir \
|
|
333
333
|
-w /workdir \
|
|
334
|
-
docker.io/pinto0309/onnx2tf:1.26.
|
|
334
|
+
docker.io/pinto0309/onnx2tf:1.26.6
|
|
335
335
|
|
|
336
336
|
or
|
|
337
337
|
|
|
@@ -1550,6 +1550,7 @@ usage: onnx2tf
|
|
|
1550
1550
|
[-ois OVERWRITE_INPUT_SHAPE [OVERWRITE_INPUT_SHAPE ...]]
|
|
1551
1551
|
[-nlt]
|
|
1552
1552
|
[-onwdt]
|
|
1553
|
+
[-snms {v4,v5}]
|
|
1553
1554
|
[-k KEEP_NCW_OR_NCHW_OR_NCDHW_INPUT_NAMES [KEEP_NCW_OR_NCHW_OR_NCDHW_INPUT_NAMES ...]]
|
|
1554
1555
|
[-kt KEEP_NWC_OR_NHWC_OR_NDHWC_INPUT_NAMES [KEEP_NWC_OR_NHWC_OR_NDHWC_INPUT_NAMES ...]]
|
|
1555
1556
|
[-kat KEEP_SHAPE_ABSOLUTELY_INPUT_NAMES [KEEP_SHAPE_ABSOLUTELY_INPUT_NAMES ...]]
|
|
@@ -1749,6 +1750,12 @@ optional arguments:
|
|
|
1749
1750
|
enable --output_nms_with_dynamic_tensor:
|
|
1750
1751
|
output_tensor_shape: [N, 7]
|
|
1751
1752
|
|
|
1753
|
+
-snms {v4,v5}, --switch_nms_version {v4,v5}
|
|
1754
|
+
Switch the NMS version to V4 or V5 to convert.
|
|
1755
|
+
e.g.
|
|
1756
|
+
NonMaxSuppressionV4(default): --switch_nms_version v4
|
|
1757
|
+
NonMaxSuppressionV5: --switch_nms_version v5
|
|
1758
|
+
|
|
1752
1759
|
-k KEEP_NCW_OR_NCHW_OR_NCDHW_INPUT_NAMES [KEEP_NCW_OR_NCHW_OR_NCDHW_INPUT_NAMES ...], \
|
|
1753
1760
|
--keep_ncw_or_nchw_or_ncdhw_input_names KEEP_NCW_OR_NCHW_OR_NCDHW_INPUT_NAMES \
|
|
1754
1761
|
[KEEP_NCW_OR_NCHW_OR_NCDHW_INPUT_NAMES ...]
|
|
@@ -2034,6 +2041,7 @@ convert(
|
|
|
2034
2041
|
overwrite_input_shape: Union[List[str], NoneType] = None,
|
|
2035
2042
|
no_large_tensor: Optional[bool] = False,
|
|
2036
2043
|
output_nms_with_dynamic_tensor: Optional[bool] = False,
|
|
2044
|
+
switch_nms_version: Optional[str] = 'v4',
|
|
2037
2045
|
keep_ncw_or_nchw_or_ncdhw_input_names: Union[List[str], NoneType] = None,
|
|
2038
2046
|
keep_nwc_or_nhwc_or_ndhwc_input_names: Union[List[str], NoneType] = None,
|
|
2039
2047
|
keep_shape_absolutely_input_names: Optional[List[str]] = None,
|
|
@@ -2239,6 +2247,12 @@ convert(
|
|
|
2239
2247
|
enable --output_nms_with_dynamic_tensor:
|
|
2240
2248
|
output_tensor_shape: [N, 7]
|
|
2241
2249
|
|
|
2250
|
+
switch_nms_version {v4,v5}
|
|
2251
|
+
Switch the NMS version to V4 or V5 to convert.
|
|
2252
|
+
e.g.
|
|
2253
|
+
NonMaxSuppressionV4(default): switch_nms_version="v4"
|
|
2254
|
+
NonMaxSuppressionV5: switch_nms_version="v5"
|
|
2255
|
+
|
|
2242
2256
|
keep_ncw_or_nchw_or_ncdhw_input_names: Optional[List[str]]
|
|
2243
2257
|
Holds the NCW or NCHW or NCDHW of the input shape for the specified INPUT OP names.
|
|
2244
2258
|
If a nonexistent INPUT OP name is specified, it is ignored.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
onnx2tf/__init__.py,sha256=
|
|
1
|
+
onnx2tf/__init__.py,sha256=D5w6RbaMF9GzXScgnbOcTItpc7gKywaN-02SRdPSjro,66
|
|
2
2
|
onnx2tf/__main__.py,sha256=2RSCQ7d4lc6CwD-rlGn9UicPFg-P5du7ZD_yh-kuBEU,57
|
|
3
|
-
onnx2tf/onnx2tf.py,sha256=
|
|
3
|
+
onnx2tf/onnx2tf.py,sha256=IEnfIs3Dy8Y5F3iJ4HY7bWkn3QuB6lq_gHa1q5E3tMI,124745
|
|
4
4
|
onnx2tf/ops/Abs.py,sha256=V7btmCG_ZvK_qJovUsguq0ZMJ349mhNQ4FHSgzP_Yuo,4029
|
|
5
5
|
onnx2tf/ops/Acos.py,sha256=Fo8YkFKuWq8Fi2xUrBdKcAH1yJ8r5pjSD0wgLttTNdk,4003
|
|
6
6
|
onnx2tf/ops/Acosh.py,sha256=ATQj2cT5JS_mTfXi0kXqJ1yzSZu5J0zHA5VjV3j7uKY,3588
|
|
@@ -96,7 +96,7 @@ onnx2tf/ops/Mod.py,sha256=K6oH5Q4I5JWh8DFp8T1CSdL4WUJCexYdfqTy5iceJxo,9999
|
|
|
96
96
|
onnx2tf/ops/Mul.py,sha256=p75MHWbJSo6jLarFzmfK6oQREar4ntlFGqn-U7MzY8s,15962
|
|
97
97
|
onnx2tf/ops/Multinomial.py,sha256=0HQC76IA3AvRsUx9RS0S__nIfEmPuvIaDfSt8bns4FU,3158
|
|
98
98
|
onnx2tf/ops/Neg.py,sha256=vu2ExVXyGpggAM_DNPeZj9QFeUyqhn5XmJnDlPJFsQU,4219
|
|
99
|
-
onnx2tf/ops/NonMaxSuppression.py,sha256=
|
|
99
|
+
onnx2tf/ops/NonMaxSuppression.py,sha256=nHeiX5eMGQAq_51KoljNZGlZddJ89Oe7Yfe33xLhl6M,15763
|
|
100
100
|
onnx2tf/ops/NonZero.py,sha256=2EYZFMNIejeqR2azHw0CT2mthiKuRPQepUafzeVE8Nk,2788
|
|
101
101
|
onnx2tf/ops/Not.py,sha256=wn3nThGf4gtpQdHjP7OX2xlhyaNQGeHifjZ18O5shhg,3599
|
|
102
102
|
onnx2tf/ops/OneHot.py,sha256=OThLm1MF1X75zx7gep_qdnRHsTRZX_tqZxjt6pAVi7E,6489
|
|
@@ -188,10 +188,10 @@ onnx2tf/utils/__init__.py,sha256=E9FM9He68VIASDnYp-OrxvHFVn55GzWqw2OEkCqn1zg,27
|
|
|
188
188
|
onnx2tf/utils/common_functions.py,sha256=lhhWuNVDwM_mVFc9DD2kYcYEyyT46CDlJMvZzi9KWD4,241473
|
|
189
189
|
onnx2tf/utils/enums.py,sha256=7c5TqetqB07VjyHoxJHfLgtqBqk9ZRyUF33fPOJR1IM,1649
|
|
190
190
|
onnx2tf/utils/logging.py,sha256=yUCmPuJ_XiUItM3sZMcaMO24JErkQy7zZwVTYWAuiKg,1982
|
|
191
|
-
onnx2tf-1.26.
|
|
192
|
-
onnx2tf-1.26.
|
|
193
|
-
onnx2tf-1.26.
|
|
194
|
-
onnx2tf-1.26.
|
|
195
|
-
onnx2tf-1.26.
|
|
196
|
-
onnx2tf-1.26.
|
|
197
|
-
onnx2tf-1.26.
|
|
191
|
+
onnx2tf-1.26.6.dist-info/LICENSE,sha256=5v_Kxihy8i6mzHVl349ikSREaIdsl9YeUnX1KBDLD2w,1070
|
|
192
|
+
onnx2tf-1.26.6.dist-info/LICENSE_onnx-tensorflow,sha256=gK4GtS9S5YcyINu6uuNNWdo-kBClyEM4MFLFGiNTeRM,11231
|
|
193
|
+
onnx2tf-1.26.6.dist-info/METADATA,sha256=YynCnx1YI6Z2O7qzh_0en21B-2V1LGUNNBARLYkpe8E,147279
|
|
194
|
+
onnx2tf-1.26.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
195
|
+
onnx2tf-1.26.6.dist-info/entry_points.txt,sha256=gDPK8ToCFPKMvm8jr9xrGOkXtORJJVh4736fBEKO5k0,41
|
|
196
|
+
onnx2tf-1.26.6.dist-info/top_level.txt,sha256=WgfPiEy3f6vZ_FOpAIEA2CF3TCx1eYrhGw93Ih6b9Fw,8
|
|
197
|
+
onnx2tf-1.26.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|