- rknn = RKNN(verbose=True)
- rknn.config(channel_mean_value='127.5 127.5 127.5 127.5', reorder_channel='0 1 2')
- print('--> loading model')
- ret = rknn.load_tensorflow(
- tf_pb='./deeplab_300x400.pb',
- inputs=['MobilenetV2/MobilenetV2/input'],
- outputs=['logits/semantic/BiasAdd'],
- input_size_list=[[300, 400, 3]])
- if ret != 0:
- print('Load model failed! Ret = {}'.format(ret))
- exit(ret)
- print('--> building model')
- ret = rknn.build(do_quantization=True, dataset='./dataset_300x400.txt')
- if ret != 0:
- print('export error')
- exit(ret)
- print('done')
复制代码
模型能够正常转化,但是在inference的时候会出现init失败:- E Catch exception when releasing runtime environment!
- T Traceback (most recent call last):
- T File "rknn/api/rknn_base.py", line 837, in rknn.api.rknn_base.RKNNBase.perf
- T File "rknn/api/redirect_stdout.py", line 76, in rknn.api.redirect_stdout.redirect_stdouter.redirect_stdout.func_wrapper
- T File "rknn/api/redirect_stdout.py", line 77, in rknn.api.redirect_stdout.redirect_stdouter.redirect_stdout.func_wrapper
- T File "rknn/api/rknn_base.py", line 932, in rknn.api.rknn_base.RKNNBase._recreate_rknn_runtime
- T File "rknn/api/rknn_runtime.py", line 275, in rknn.api.rknn_runtime.RKNNRuntime.build_graph
- T Exception: RKNN init failed. error code: RKNN_ERR_FAIL
- E Performance information is empty, some mistakes may happened.
- E [op_check:280]Concat input dims size(25 vs 19)
- E [setup_node:337]Check node[103] CONCAT fail
- E Catch exception when init model!
- T Traceback (most recent call last):
- T File "rknn/api/rknn_base.py", line 625, in rknn.api.rknn_base.RKNNBase.inference
- T File "rknn/api/rknn_runtime.py", line 275, in rknn.api.rknn_runtime.RKNNRuntime.build_graph
- T Exception: RKNN init failed. error code: RKNN_ERR_FAIL
复制代码
这里会说“E [op_check:280]Concat input dims size(25 vs 19)” 19是300尺寸的那个边对应的维度,25是400尺寸的那个边对应的维度,这里的错误显然是原本应该是19现在成了25(或者反过来)zhangzj 发表于 2019-4-24 09:04
长宽不一样的这个pb用TensorFlow可以正常推理吗?
protossw512 发表于 2019-4-30 01:26
能反馈给开发组看看吗?
zhangzj 发表于 2019-4-30 09:56
原始的pb文件能发出来吗?开发组需要原始模型才能看。
- rknn.config(channel_mean_value='127.5 127.5 127.5 127.5', reorder_channel='0 1 2')
- ret = rknn.load_tensorflow(
- tf_pb='./frozen_inference_graph-300x400_epoch0.pb',
- inputs=['MobilenetV2/MobilenetV2/input'],
- outputs=['logits/semantic/BiasAdd'],
- input_size_list=[[300, 400, 3]])
- ret = rknn.build(do_quantization=True, dataset='./300x400_data.txt')
复制代码
模型可以正常转换,但是在读取的时候会报错:- --> Init runtime environment
- done
- E [op_check:280]Concat input dims size(25 vs 19)
- E [setup_node:337]Check node[106] CONCAT fail
- E Catch exception when init model!
- T Traceback (most recent call last):
- T File "rknn/api/rknn_base.py", line 625, in rknn.api.rknn_base.RKNNBase.inference
- T File "rknn/api/rknn_runtime.py", line 275, in rknn.api.rknn_runtime.RKNNRuntime.build_graph
- T Exception: RKNN init failed. error code: RKNN_ERR_FAIL
- Traceback (most recent call last):
- File "eval_performance.py", line 44, in <module>
- pred = prediction[0]
- TypeError: 'NoneType' object is not subscriptable
复制代码
注意这行:E [op_check:280]Concat input dims size(25 vs 19) 实际就是在25x19的feature map上concat的时候尺寸不对,长宽反了,但是在转换模型的时候,包括量化的时候都没有报错。- --> Init runtime environment
- done
- E Catch exception when init model!
- T Traceback (most recent call last):
- T File "rknn/api/rknn_base.py", line 679, in rknn.api.rknn_base.RKNNBase.get_run_perf_on_hardware
- T File "rknn/api/rknn_runtime.py", line 275, in rknn.api.rknn_runtime.RKNNRuntime.build_graph
- T Exception: RKNN init failed. error code: RKNN_ERR_MODEL_INVALID
- E Performance information is empty, some mistakes may happened.
- E Catch exception when init model!
- T Traceback (most recent call last):
- T File "rknn/api/rknn_base.py", line 625, in rknn.api.rknn_base.RKNNBase.inference
- T File "rknn/api/rknn_runtime.py", line 275, in rknn.api.rknn_runtime.RKNNRuntime.build_graph
- T Exception: RKNN init failed. error code: RKNN_ERR_MODEL_INVALID
- Traceback (most recent call last):
- File "eval_performance.py", line 44, in <module>
- pred = prediction[0]
- TypeError: 'NoneType' object is not subscriptable
复制代码
- init model done
- rknn_init fail! ret=-6
复制代码
查了下也是"RKNN_ERROR_MODEL_INVALID"- T ValueError: Negative dimension size caused by subtracting 25 from 19 for 'AvgPool2D/AvgPool_54/AvgPool' (op: 'AvgPool') with input shapes: [100,25,19,160].
- export error
复制代码
但是如果我不量化直接转换成16bit,可以正常转换,但是在inference的时候会卡死在init上不动:- --> Init runtime environment
- done
复制代码
所以我分析在量化的时候和实际读取inference的时候长宽的维度给弄反了,希望能够调查一下,否则只能输入400x400的图像,对运算速度会是不小的增加。zhangzj 发表于 2019-4-30 09:56
原始的pb文件能发出来吗?开发组需要原始模型才能看。
欢迎光临 Toybrick (https://t.rock-chips.com/) | Powered by Discuz! X3.3 |