|
6#
楼主 |
发表于 2019-5-3 06:34:48
|
只看该作者
本帖最后由 protossw512 于 2019-5-3 07:00 编辑
好的,模型在这里(其实就是tensorflow的deeplabv3+):
https://www.dropbox.com/s/kvipjd ... x400_epoch0.pb?dl=0
这个并不是训练好的模型,只是在变量初始化好就保存的,所以输出会比较随机,但是不影响调试。
我转换时的配置如下:
- 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')
模型可以正常转换,但是在读取的时候会报错:
在x86版本的rknn上运行会报错:
- --> 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的时候尺寸不对,长宽反了,但是在转换模型的时候,包括量化的时候都没有报错。
在3399pro上运行也是初始化报错,但是没有说为什么
- --> 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
在3399pro的c++版本也会报错:- init model done
- rknn_init fail! ret=-6
查了下也是"RKNN_ERROR_MODEL_INVALID"
如果我在转换模型的时候把input_size_list设置成[[400, 300, 3]],那么无法通过量化:
- 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的图像,对运算速度会是不小的增加。
|
|