tensorflow-onnx
tensorflow-onnx copied to clipboard
ERROR - Tensorflow op [UnravelIndex: UnravelIndex] is not supported
Describe the bug I am trying to convert savedModel from checkpoints of deeplabcut to onnx but getting while converting. I have tried with different opsets as well.
System information
- windows 10
- Tensorflow 2.7:
- Python 3.7:
python -m tf2onnx.convert --saved-model "C:\Users\Naqi\Desktop\DLC\BlackMosue-Mouse1-2022-07-24\dlc-models\iteration-0\BlackMosueJul24-trainset95shuffle1\train\12\svdm" --output model10.onnx --opset 10
C:\Users\Naqi\AppData\Local\Programs\Python\Python37\lib\runpy.py:125: RuntimeWarning: 'tf2onnx.convert' found in sys.modules after import of package 'tf2onnx', but prior to execution of 'tf2onnx.convert'; this may result in unpredictable behaviour
warn(RuntimeWarning(msg))
2022-08-04 16:42:40,857 - WARNING - '--tag' not specified for saved_model. Using --tag serve
2022-08-04 16:42:42,534 - INFO - Signatures found in model: [serving_default].
2022-08-04 16:42:42,534 - WARNING - '--signature_def' not specified, using first signature: serving_default
2022-08-04 16:42:42,538 - INFO - Output names: ['out']
WARNING:tensorflow:Issue encountered when serializing model_variables.
Type is unsupported, or the types of the items don't match field type in CollectionDef. Note this is a warning and probably safe to ignore.
This operation is not supported when eager execution is enabled.
2022-08-04 16:42:42,553 - WARNING - Issue encountered when serializing model_variables.
Type is unsupported, or the types of the items don't match field type in CollectionDef. Note this is a warning and probably safe to ignore.
This operation is not supported when eager execution is enabled.
WARNING:tensorflow:Issue encountered when serializing variables.
Type is unsupported, or the types of the items don't match field type in CollectionDef. Note this is a warning and probably safe to ignore.
This operation is not supported when eager execution is enabled.
2022-08-04 16:42:42,558 - WARNING - Issue encountered when serializing variables.
Type is unsupported, or the types of the items don't match field type in CollectionDef. Note this is a warning and probably safe to ignore.
This operation is not supported when eager execution is enabled.
WARNING:tensorflow:Issue encountered when serializing trainable_variables.
Type is unsupported, or the types of the items don't match field type in CollectionDef. Note this is a warning and probably safe to ignore.
This operation is not supported when eager execution is enabled.
2022-08-04 16:42:42,559 - WARNING - Issue encountered when serializing trainable_variables.
Type is unsupported, or the types of the items don't match field type in CollectionDef. Note this is a warning and probably safe to ignore.
This operation is not supported when eager execution is enabled.
WARNING:tensorflow:From C:\Users\Naqi\AppData\Local\Programs\Python\Python37\lib\site-packages\tf2onnx\tf_loader.py:711: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.extract_sub_graph`
2022-08-04 16:42:43,535 - WARNING - From C:\Users\Naqi\AppData\Local\Programs\Python\Python37\lib\site-packages\tf2onnx\tf_loader.py:711: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.extract_sub_graph`
2022-08-04 16:42:43,908 - INFO - Using tensorflow=2.7.0, onnx=1.11.0, tf2onnx=1.12.0/a58786
2022-08-04 16:42:43,908 - INFO - Using opset <onnx, 10>
2022-08-04 16:42:44,423 - INFO - Computed 2 values for constant folding
2022-08-04 16:42:44,796 - INFO - folding node using tf type=StridedSlice, name=strided_slice_3
2022-08-04 16:42:44,797 - INFO - folding node using tf type=StridedSlice, name=strided_slice_11
2022-08-04 16:42:45,150 - WARNING - Conv Backprop Input with strides > 1 and non-constant shape has known bug. Workaround requires opset 12.
2022-08-04 16:42:45,167 - WARNING - Conv Backprop Input with strides > 1 and non-constant shape has known bug. Workaround requires opset 12.
2022-08-04 16:42:45,255 - ERROR - Tensorflow op [UnravelIndex: UnravelIndex] is not supported
2022-08-04 16:42:45,727 - ERROR - Unsupported ops: Counter({'UnravelIndex': 1})
2022-08-04 16:42:45,802 - INFO - Optimizing ONNX model
2022-08-04 16:42:49,316 - INFO - After optimization: Cast -5 (71->66), Concat -3 (18->15), Const -332 (520->188), Div -1 (59->58), Gather +4 (59->63), Identity -89 (97->8), Mul -3 (9->6), Reshape -19 (27->8), Shape -3 (62->59), Size -1 (4->3), Slice -11 (34->23), Squeeze -11 (72->61), Transpose -227 (233->6), Unsqueeze -15 (20->5)
2022-08-04 16:42:49,383 - INFO -
2022-08-04 16:42:49,383 - INFO - Successfully converted TensorFlow model C:\Users\Naqi\Desktop\DLC\BlackMosue-Mouse1-2022-07-24\dlc-models\iteration-0\BlackMosueJul24-trainset95shuffle1\train\12\svdm to ONNX
2022-08-04 16:42:49,387 - INFO - Model inputs: ['in']
2022-08-04 16:42:49,388 - INFO - Model outputs: ['out']
2022-08-04 16:42:49,388 - INFO - ONNX model is saved at model10.onnx
Hi @IamNaQi, I am having the same problem when converting graphdef from checkpoints of deeplabcut to onnx. Did you manage to solve your problem?
System information
windows 11 Tensorflow 2.13: Python 3.8.12:
C:\Users\ainho\anaconda3\envs\DEEPLABCUT\lib\site-packages\scipy_init_.py:138: UserWarning: A NumPy version >=1.16.5 and <1.23.0 is required for this version of SciPy (detected version 1.24.3) warnings.warn(f"A NumPy version >={np_minversion} and <{np_maxversion} is required for this version of " C:\Users\ainho\anaconda3\envs\DEEPLABCUT\lib\runpy.py:127: RuntimeWarning: 'tf2onnx.convert' found in sys.modules after import of package 'tf2onnx', but prior to execution of 'tf2onnx.convert'; this may result in unpredictable behaviour warn(RuntimeWarning(msg)) WARNING:tensorflow:From C:\Users\ainho\anaconda3\envs\DEEPLABCUT\lib\site-packages\tf2onnx\tf_loader.py:302: convert_variables_to_constants (from tensorflow.python.framework.convert_to_constants) is deprecated and will be removed in a future version. Instructions for updating: This API was designed for TensorFlow v1. See https://www.tensorflow.org/guide/migrate for instructions on how to migrate your code to TensorFlow v2. 2023-08-22 09:50:19,457 - WARNING - From C:\Users\ainho\anaconda3\envs\DEEPLABCUT\lib\site-packages\tf2onnx\tf_loader.py:302: convert_variables_to_constants (from tensorflow.python.framework.convert_to_constants) is deprecated and will be removed in a future version. Instructions for updating: This API was designed for TensorFlow v1. See https://www.tensorflow.org/guide/migrate for instructions on how to migrate your code to TensorFlow v2. WARNING:tensorflow:From C:\Users\ainho\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\framework\convert_to_constants.py:946: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version. Instructions for updating: This API was designed for TensorFlow v1. See https://www.tensorflow.org/guide/migrate for instructions on how to migrate your code to TensorFlow v2. 2023-08-22 09:50:19,457 - WARNING - From C:\Users\ainho\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\framework\convert_to_constants.py:946: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version. Instructions for updating: This API was designed for TensorFlow v1. See https://www.tensorflow.org/guide/migrate for instructions on how to migrate your code to TensorFlow v2. 2023-08-22 09:50:20,971 - INFO - Using tensorflow=2.13.0, onnx=1.14.0, tf2onnx=1.14.0/015202 2023-08-22 09:50:20,971 - INFO - Using opset <onnx, 15> 2023-08-22 09:50:21,807 - INFO - Computed 2 values for constant folding 2023-08-22 09:50:22,397 - INFO - folding node using tf type=StridedSlice, name=strided_slice_3 2023-08-22 09:50:22,397 - INFO - folding node using tf type=StridedSlice, name=strided_slice_11 2023-08-22 09:50:23,359 - ERROR - Tensorflow op [UnravelIndex: UnravelIndex] is not supported 2023-08-22 09:50:23,361 - ERROR - Unsupported ops: Counter({'UnravelIndex': 1}) 2023-08-22 09:50:23,430 - INFO - Optimizing ONNX model 2023-08-22 09:50:28,641 - INFO - After optimization: BatchNormalization -50 (53->3), Cast -4 (37->33), Concat +11 (44->55), Const -529 (674->145), Gather +7 (1->8), Identity -1 (1->0), Mul -3 (27->24), Shape -1 (9->8), Slice -7 (47->40), Split +11 (6->17), Squeeze -29 (34->5), Transpose -232 (250->18), Unsqueeze -45 (62->17) 2023-08-22 09:50:28,974 - INFO - 2023-08-22 09:50:28,974 - INFO - Successfully converted TensorFlow model C:\Users\ainho\OneDrive\Escritorio\LBWT_Tracker\exported_model\graphdef\snapshot-900000.pb to ONNX 2023-08-22 09:50:28,974 - INFO - Model inputs: ['Placeholder:0'] 2023-08-22 09:50:28,984 - INFO - Model outputs: ['concat_1:0'] 2023-08-22 09:50:28,984 - INFO - ONNX model is saved at C:\Users\ainho\OneDrive\Escritorio\LBWT_Tracker\exported_model\model3.onnx
just a kind bump.
Would a PR be accepted for this feature?