|
Hi,
使用 rknn 转换一个由 pytoch 导出的 onnx 模型时, 在 rknn.build 阶段发生了错误。还请各位帮忙诊断原因。 感谢。
错误信息:
E Catch exception when building RKNN model! E Traceback (most recent call last): E File "/home/bowie/miniconda3/envs/rknn/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 1607, in _create_c_op E c_op = c_api.TF_FinishOperation(op_desc) E tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimensions must be equal, but are 512 and 256 for 'ConvTranspose_251_31_2/Add' (op: 'Add') with input shapes: [100,16,16,512], [256]. E During handling of the above exception, another exception occurred:
...... E File "rknn/base/RKNNlib/layer/RKNNlayer.py", line 287, in rknn.base.RKNNlib.layer.RKNNlayer.RKNNLayer.compute_tensor E File "rknn/base/RKNNlib/layer/deconvolution.py", line 121, in rknn.base.RKNNlib.layer.deconvolution.Deconvolution.compute_out_tensor
...... E File "/home/bowie/miniconda3/envs/rknn/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 1770, in __init__ E control_input_ops) E File "/home/bowie/miniconda3/envs/rknn/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 1610, in _create_c_op E raise ValueError(str(e))
E ValueError: Dimensions must be equal, but are 512 and 256 for 'ConvTranspose_251_31_2/Add' (op: 'Add') with input shapes: [100,16,16,512], [256].
onnx 模型可以正常由 onnxruntime 进行推理,并且结果正常。
运行环境如下:
操作系统 Linux 5.4.0-31-generic #35-Ubuntu SMP x86_64
python Python 3.6.10 |Anaconda, Inc.
rknn-toolkit 1.3.2
torch 1.3.1
tensorflow-gpu 1.15.0
onnx 1.4.1
onnxruntime 1.3.0
转换代码:
rknn = RKNN()
rknn.config(channel_mean_value='128 128 128 128', target_platform=['rk3399pro'])
rknn.load_onnx('model.onnx')
rknn.build(do_quantization=True)
另外,经过测试,在模型输入层后插入的 Sub、Div 等层也会遇到这种 “Dimensions must be equal” 的错误。
还请各位帮忙诊断一下问题。
感谢。
|
|