Skip to content

Conversation

TomWildenhain-Microsoft
Copy link
Collaborator

Signed-off-by: Tom Wildenhain [email protected]

@TomWildenhain-Microsoft TomWildenhain-Microsoft linked an issue Sep 2, 2021 that may be closed by this pull request
Signed-off-by: Tom Wildenhain <[email protected]>
@lamhoangtung
Copy link

lamhoangtung commented Sep 3, 2021

Thanks for the work @TomWildenhain-Microsoft.

What tensorflow version are you using for this? I've been trying this commit for issue #1686 but having Segmentation fault: 11 on both tensorflow 1.15 and 2.6.0.

What I've tried:

pip3 install git+https://github.com/onnx/tensorflow-onnx@tom/symmetric_padding
python3 -m tf2onnx.convert \
    --graphdef weights/COCO-MaskRCNN-R50C41x.pb \
    --output weights/test.onnx \
    --inputs image:0 \
    --outputs output/boxes:0,output/scores:0,output/labels:0,output/masks:0 \
    --opset 15

Output with tensorflow 2.6:

/Users/linus/anaconda3/envs/tf2_2/lib/python3.7/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))
WARNING:tensorflow:From /Users/linus/anaconda3/envs/tf2_2/lib/python3.7/site-packages/tf2onnx/tf_loader.py:305: convert_variables_to_constants (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.convert_variables_to_constants`
2021-09-03 22:25:52,312 - WARNING - From /Users/linus/anaconda3/envs/tf2_2/lib/python3.7/site-packages/tf2onnx/tf_loader.py:305: convert_variables_to_constants (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.convert_variables_to_constants`
WARNING:tensorflow:From /Users/linus/anaconda3/envs/tf2_2/lib/python3.7/site-packages/tensorflow/python/framework/convert_to_constants.py:927: 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`
2021-09-03 22:25:52,313 - WARNING - From /Users/linus/anaconda3/envs/tf2_2/lib/python3.7/site-packages/tensorflow/python/framework/convert_to_constants.py:927: 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`
2021-09-03 22:25:57,769 - INFO - Using tensorflow=2.6.0, onnx=1.10.1, tf2onnx=1.10.0/46e239
2021-09-03 22:25:57,769 - INFO - Using opset <onnx, 15>
2021-09-03 22:26:11,073 - INFO - Computed 2 values for constant folding
2021-09-03 22:26:17,887 - INFO - folding node using tf type=Mul, name=maskrcnn/deconv/mul
2021-09-03 22:26:17,888 - INFO - folding node using tf type=Mul, name=maskrcnn/deconv/mul_1
./to_onnx.sh: line 6: 15937 Segmentation fault: 11  python3 -m tf2onnx.convert --graphdef weights/COCO-MaskRCNN-R50C41x.pb --output weights/test.onnx --inputs image:0 --outputs output/boxes:0,output/scores:0,output/labels:0,output/masks:0 --opset 15

With tensorflow 1.15:

/Users/linus/anaconda3/envs/tf2_2/lib/python3.7/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))
WARNING:tensorflow:From /Users/linus/anaconda3/envs/tf2_2/lib/python3.7/site-packages/tf2onnx/verbose_logging.py:76: The name tf.logging.set_verbosity is deprecated. Please use tf.compat.v1.logging.set_verbosity instead.

2021-09-03 22:20:47,185 - WARNING - From /Users/linus/anaconda3/envs/tf2_2/lib/python3.7/site-packages/tf2onnx/verbose_logging.py:76: The name tf.logging.set_verbosity is deprecated. Please use tf.compat.v1.logging.set_verbosity instead.

2021-09-03 22:20:55,109 - INFO - Using tensorflow=1.15.0, onnx=1.10.1, tf2onnx=1.10.0/46e239
2021-09-03 22:20:55,110 - INFO - Using opset <onnx, 15>
2021-09-03 22:21:07,678 - INFO - Computed 2 values for constant folding
2021-09-03 22:21:15,321 - INFO - folding node using tf type=Mul, name=maskrcnn/deconv/mul
2021-09-03 22:21:15,321 - INFO - folding node using tf type=Mul, name=maskrcnn/deconv/mul_1
./to_onnx.sh: line 6: 15310 Segmentation fault: 11  python3 -m tf2onnx.convert --graphdef weights/COCO-MaskRCNN-R50C41x.pb --output weights/test.onnx --inputs image:0 --outputs output/boxes:0,output/scores:0,output/labels:0,output/masks:0 --opset 15

@TomWildenhain-Microsoft
Copy link
Collaborator Author

@lamhoangtung opset 15 isn't released yet. Try opset 14. I'm using tensorflow==2.5.0 and onnx==1.10.1 with --opset 14 and it converts successfully.

@lamhoangtung
Copy link

lamhoangtung commented Sep 4, 2021

Thanks @TomWildenhain-Microsoft. It's working with --opset 14

@TomWildenhain-Microsoft TomWildenhain-Microsoft merged commit 90f3689 into master Sep 8, 2021
@TomWildenhain-Microsoft TomWildenhain-Microsoft deleted the tom/symmetric_padding branch September 8, 2021 18:20
@TomWildenhain-Microsoft TomWildenhain-Microsoft linked an issue Sep 13, 2021 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ValueError: symmetric pad mode is not supported Tensorflow op MirrorPad is not supported
3 participants