|
环境:ubuntu 18.04
RKNN-Tool版本:1.2.1 (1.3版本由于网络原因无法下载)
模型:tensorflow
转换代码如下:
from rknn.api import RKNN
INPUT_SIZE = 512
if __name__ == '__main__':
rknn = RKNN()
rknn.config(channel_mean_value='0 0 0 255', reorder_channel='2 1 0')
print('--> Loading tensorflow model')
rknn.load_tensorflow(tf_pb='./mobilebet.pb',
inputs=['input_1'],
outputs=['dense_2/Sigmoid'],
input_size_list=[[INPUT_SIZE, INPUT_SIZE, 3]])
print('done')
print('--> Building rknn model')
rknn.build(do_quantization=False)
print('done')
rknn.export_rknn('./Mob2.rknn')
rknn.release()
报错信息如下:
Instructions for updating:
Use tf.compat.v1.graph_util.extract_sub_graph
E Catch exception when loading tensorflow model: ./mobilebet.pb!
E Traceback (most recent call last):
E File "rknn/api/rknn_base.py", line 190, in rknn.api.rknn_base.RKNNBase.load_tensorflow
E File "rknn/base/RKNNlib/converter/convert_tf.py", line 639, in rknn.base.RKNNlib.converter.convert_tf.convert_tf.match_paragraph_and_param
E File "rknn/base/RKNNlib/layer/customlayer.py", line 72, in rknn.base.RKNNlib.layer.customlayer.CustomLayer.load_params_from_tf
E TypeError: load_params_from_tf() takes at least 5 positional arguments (3 given)
done
--> Building rknn model
Traceback (most recent call last):
File "convert_rknn_tensorflow.py", line 28, in <module>
rknn.build(do_quantization=False)
File "/usr/local/lib/python3.6/dist-packages/rknn/api/rknn.py", line 148, in build
inputs = self.rknn_base.net.get_input_layers()
AttributeError: 'NoneType' object has no attribute 'get_input_layers'
|
|