|
5#
楼主 |
发表于 2020-8-7 09:40:31
|
只看该作者
pytorch模型导出的时候onnx opset_version设置为9, onnx版本切换为1.4.1,最后还是报一样的错误。
导出onnx模型的时候代码设置:
- torch.onnx.export(net, input, 'netCRNN_rknn.onnx', export_params=True, verbose=True, opset_version=9)
onnx转rknn代码:
- # Create RKNN object
- rknn = RKNN(verbose=True)
- # pre-process config
- print('--> config model')
- rknn.config(channel_mean_value='0 0 0 1', reorder_channel='0 1 2')
- print('done')
- # Load onnx model
- print('--> Loading model')
- ret = rknn.load_onnx(model='../netCRNN_rknn.onnx')
- if ret != 0:
- print('Load model failed!')
- exit(ret)
- print('done')
onnx模型所有node的op_type如下:
{'Gather', 'Conv', 'Clip', 'LSTM', 'Gemm', 'Constant', 'Pad', 'Transpose', 'Add', 'Reshape', 'Slice', 'ConstantOfShape', 'Shape', 'Concat', 'BatchNormalization', 'Relu', 'MaxPool', 'Mul', 'Squeeze', 'Sub', 'Unsqueeze', 'Div'}
报错:
E Catch exception when loading onnx model: ../netCRNN_rknn.onnx!
E Traceback (most recent call last):
E File "rknn/api/rknn_base.py", line 510, in rknn.api.rknn_base.RKNNBase.load_onnx
E File "rknn/base/RKNNlib/converter/convert_onnx.py", line 514, in rknn.base.RKNNlib.converter.convert_onnx.convert_onnx.__init__
E File "rknn/base/RKNNlib/converter/convert_onnx.py", line 176, in rknn.base.RKNNlib.converter.convert_onnx.onnx_shape_infer_engine.infer_shape
E File "rknn/base/RKNNlib/converter/convert_onnx.py", line 131, in rknn.base.RKNNlib.converter.convert_onnx.onnx_shape_infer_engine.__status_update
E File "rknn/base/RKNNlib/converter/convert_onnx.py", line 165, in rknn.base.RKNNlib.converter.convert_onnx.onnx_shape_infer_engine.__model_rebuild
E File "rknn/base/RKNNlib/converter/tensor_model.py", line 330, in rknn.base.RKNNlib.converter.tensor_model.TensorModel.build_onnx_model
E KeyError: ''
Load model failed! |
|