Paddle2ONNX icon indicating copy to clipboard operation
Paddle2ONNX copied to clipboard

SMOKE static model export to ONNX

Open Gewaihir opened this issue 4 years ago • 7 comments

Dear Author. Hello! I have encountered a problem. I am using the SMOKE model and following the instructions in README.MD to export the model as a static diagram model. However, the following error occurs when converting the static diagram model to ONNX model. Configuration environment. onnx=1.9.0 onnxruntime=1.9.0 paddle2onnx=0.8.2 paddledet=2.3.0 paddlepaddle-gpu=2.2.0 Error message

/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/onnx/mapping.py:27: DeprecationWarning: `np.object` is a deprecated alias for the builtin `object`. To silence this warning, use `object` by itself. Doing this will not modify any behavior and is safe. 
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  int(TensorProto.STRING): np.dtype(np.object)
/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/constant/dtypes.py:45: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  np.bool: core.VarDesc.VarType.BOOL,
/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/constant/dtypes.py:46: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  core.VarDesc.VarType.FP32: np.float,
/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/constant/dtypes.py:51: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  core.VarDesc.VarType.BOOL: np.bool
Traceback (most recent call last):
  File "/home/lee/.conda/envs/paddle/bin/paddle2onnx", line 8, in <module>
    sys.exit(main())
  File "/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/command.py", line 148, in main
    program2onnx(
  File "/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/command.py", line 114, in program2onnx
    p2o.program2onnx(
  File "/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/convert.py", line 79, in program2onnx
    export_onnx(paddle_graph, save_file, opset_version, enable_onnx_checker, operator_export_type)
  File "/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/convert.py", line 33, in export_onnx
    onnx_graph = ONNXGraph.build(paddle_graph, opset_version, operator_export_type, verbose)
  File "/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/graph/onnx_graph.py", line 240, in build
    onnx_graph = ONNXGraph(paddle_graph, opset_version=opset_version, operator_export_type=operator_export_type)
  File "/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/graph/onnx_graph.py", line 79, in __init__
    self.update_opset_version()
  File "/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/graph/onnx_graph.py", line 194, in update_opset_version
    self.opset_version = OpMapper.get_recommend_opset_version(node_map, self.opset_version)
  File "/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/op_mapper/op_mapper.py", line 127, in get_recommend_opset_version
    recommend_opset_version = OpMapper.check_support_status(node_map, opset_version, True)
  File "/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/op_mapper/op_mapper.py", line 168, in check_support_status
    raise NotImplementedError(error_info)
NotImplementedError: 
There's 9 ops are not supported yet
=========== while ===========
=========== set_value ===========
=========== crop_tensor ===========
=========== logical_not ===========
=========== less_than ===========
=========== select_input ===========
=========== conditional_block ===========
=========== index_select ===========
=========== atan ===========

This error indicates that nine operators are not supported. After checking the list of operators, I found only 'conditional-block', 'set-value', and 'while', 'select-input' and 'crop-tensor' are not available. Here are the commands I used for the conversion. paddle2onnx --model_dir /media/lee/DATA/project/gitproject/models/PaddleCV/3d_vision/SMOKE/inference_model --model_filename inference.pdmodel --params_filename inference.pdiparams --opset_version 11 --save_file smoke.onnx How should I solve such a situation? I look forward to your reply!

Gewaihir avatar Nov 26 '21 01:11 Gewaihir

Sorry, we still do not support the conversion of this model, we will provide support as soon as possible. In addition, why did you convert this model to ONNX? If used for deployment, welcome to use PaddleInference or PaddleLIte for deployment.

yeliang2258 avatar Nov 26 '21 02:11 yeliang2258

@yeliang2258 Thank you for your suggestion. I'll try to use PaddleInference and PaddleLIte to convert. As you said, it is needed to deploy to a lab development board for doing experimental design.

Gewaihir avatar Nov 26 '21 07:11 Gewaihir

Thank you very much for using Paddle. We have prepared a simple survey questionnaire (can be completed in half a minute). If you have time, please help us to complete the survey and help Paddle2ONNX to be better, thank you. https://iwenjuan.baidu.com/?code=ibd2b1

yeliang2258 avatar Dec 02 '21 08:12 yeliang2258

There's 5 ops are not supported yet =========== crop_tensor =========== =========== while =========== =========== select_input =========== =========== conditional_block =========== =========== set_value ===========

Any plan to do this?

sinopec avatar Jan 05 '22 03:01 sinopec

Sorry, we still do not support the conversion of this model, we will provide support as soon as possible. In addition, why did you convert this model to ONNX? If used for deployment, welcome to use PaddleInference or PaddleLIte for deployment.

We want to use the openvino hardware acceloration,So onnx is a must.

sinopec avatar Jan 05 '22 04:01 sinopec

Dear Author. Hello! I have encountered a problem. I am using the SMOKE model and following the instructions in README.MD to export the model as a static diagram model. However, the following error occurs when converting the static diagram model to ONNX model. Configuration environment. onnx=1.9.0 onnxruntime=1.9.0 paddle2onnx=0.8.2 paddledet=2.3.0 paddlepaddle-gpu=2.2.0 Error message

/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/onnx/mapping.py:27: DeprecationWarning: `np.object` is a deprecated alias for the builtin `object`. To silence this warning, use `object` by itself. Doing this will not modify any behavior and is safe. 
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  int(TensorProto.STRING): np.dtype(np.object)
/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/constant/dtypes.py:45: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  np.bool: core.VarDesc.VarType.BOOL,
/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/constant/dtypes.py:46: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  core.VarDesc.VarType.FP32: np.float,
/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/constant/dtypes.py:51: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  core.VarDesc.VarType.BOOL: np.bool
Traceback (most recent call last):
  File "/home/lee/.conda/envs/paddle/bin/paddle2onnx", line 8, in <module>
    sys.exit(main())
  File "/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/command.py", line 148, in main
    program2onnx(
  File "/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/command.py", line 114, in program2onnx
    p2o.program2onnx(
  File "/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/convert.py", line 79, in program2onnx
    export_onnx(paddle_graph, save_file, opset_version, enable_onnx_checker, operator_export_type)
  File "/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/convert.py", line 33, in export_onnx
    onnx_graph = ONNXGraph.build(paddle_graph, opset_version, operator_export_type, verbose)
  File "/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/graph/onnx_graph.py", line 240, in build
    onnx_graph = ONNXGraph(paddle_graph, opset_version=opset_version, operator_export_type=operator_export_type)
  File "/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/graph/onnx_graph.py", line 79, in __init__
    self.update_opset_version()
  File "/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/graph/onnx_graph.py", line 194, in update_opset_version
    self.opset_version = OpMapper.get_recommend_opset_version(node_map, self.opset_version)
  File "/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/op_mapper/op_mapper.py", line 127, in get_recommend_opset_version
    recommend_opset_version = OpMapper.check_support_status(node_map, opset_version, True)
  File "/home/lee/.conda/envs/paddle/lib/python3.8/site-packages/paddle2onnx/op_mapper/op_mapper.py", line 168, in check_support_status
    raise NotImplementedError(error_info)
NotImplementedError: 
There's 9 ops are not supported yet
=========== while ===========
=========== set_value ===========
=========== crop_tensor ===========
=========== logical_not ===========
=========== less_than ===========
=========== select_input ===========
=========== conditional_block ===========
=========== index_select ===========
=========== atan ===========

This error indicates that nine operators are not supported. After checking the list of operators, I found only 'conditional-block', 'set-value', and 'while', 'select-input' and 'crop-tensor' are not available. Here are the commands I used for the conversion. paddle2onnx --model_dir /media/lee/DATA/project/gitproject/models/PaddleCV/3d_vision/SMOKE/inference_model --model_filename inference.pdmodel --params_filename inference.pdiparams --opset_version 11 --save_file smoke.onnx How should I solve such a situation? I look forward to your reply!

Have you already converted SMOKE model to ONNX successfully?

hitbuyi avatar Sep 26 '22 11:09 hitbuyi