PaddlePaddle / Paddle2ONNX

ONNX Model Exporter for PaddlePaddle
Apache License 2.0
726 stars 171 forks source link

载入转换后的onnx模型失败:Error in Node:ScatterND@1 : No Op registered for ScatterND with domain_version of 9 #198

Closed damengdameng closed 3 years ago

damengdameng commented 3 years ago

训练的模型是识别模型:CRNN(mobilenetv3_small+bilstm+ctc)

paddle转onnx命令:

paddle2onnx --model_dir inference/rec_crnn/ --model_filename inference.pdmodel --params_filename inference.pdiparams --save_file onxx_model/test.onnx

onnxruntime加载onnx模型报错:

Traceback (most recent call last):
  File "mn_rec.py", line 60, in <module>
    text_recognizer = TextRecognizer()
  File "mn_rec.py", line 12, in __init__
    self.session = onnxruntime.InferenceSession(rec_model_path)
  File "/data01/wanming/paddle_env/paddle/lib/python3.6/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 206, in __init__
    self._create_inference_session(providers, provider_options)
  File "/data01/wanming/paddle_env/paddle/lib/python3.6/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 226, in _create_inference_session
    sess = C.InferenceSession(session_options, self._model_path, True, self._read_config_from_model)
onnxruntime.capi.onnxruntime_pybind11_state.InvalidGraph: [ONNXRuntimeError] : 10 : INVALID_GRAPH : Load model from /data01/wanming/paddle2/onnx/rec/weights/test.onnx failed:This is an invalid model. Error in Node:ScatterND@1 : No Op registered for ScatterND with domain_version of 9

已经尝试过的方法:

设置 --opset_version 12,报错无变化 设置 --opset_version 11,报错无变化 设置 --opset_version 10,显示有算子不支持 建议>=11 加载其他onnx模型:可以正常加载 pip uninstall paddle2onnx,在十分钟前下载源码 python setup.py intstall 安装paddle2onnx: 报错无变化

环境: paddle2onnx: 0.5 paddlepaddle-gpu: 2.0.0.post100 onnxruntime: 1.6.0

damengdameng commented 3 years ago

解决了。。。打扰了😅