Toybrick

rknn模型转换失败

qiaoqiang126

中级会员

积分
225
楼主
发表于 2019-1-29 18:11:21    查看: 6763|回复: 8 | [复制链接]    打印 | 显示全部楼层
直接上代码:



from rknn.api import RKNN

INPUT_SIZE = 300
if __name__ == '__main__':
    # Create RKNN object
    rknn = RKNN()

    # Config for Model Input PreProcess
    rknn.config(batch_size=1,channel_mean_value='128 128 128 128', reorder_channel='0 1 2')

    # Load TensorFlow Model
    print('--> Loading model')
    rknn.load_tensorflow(tf_pb='./model.pb',
                         inputs=['input_qq'],
                         outputs=['out'],
                         input_size_list=[[96, 300, 3]])
    print('done')

    # Build Model
    print('--> Building model')
    rknn.build(do_quantization=False)
    print('done')

    # Export RKNN Model
    rknn.export_rknn('./model.rknn')


# Release RKNN Context
rknn.release()
错误信息:

AttributeError: 'NoneType' object has no attribute 'op'


有什么解决办法吗?




回复

使用道具 举报

qiaoqiang126

中级会员

积分
225
沙发
 楼主| 发表于 2019-1-30 09:42:42 | 显示全部楼层
文件里是pb模型的结构和具体节点名称,大小                       pb文件能上传吗?太大了

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

qiaoqiang126

中级会员

积分
225
板凳
 楼主| 发表于 2019-2-15 10:52:33 | 显示全部楼层
zhangzj 发表于 2019-2-15 09:16
用0.9.8版本rknn-toolkit,把转换信息开起来,看看报什么错

0.9.8版本下载地址:

W verbose file path is invalid, debug info will not dump to file.
--> Init runtime environment
done
--> Loading model
D import clients finished
E Catch exception when loading tensorflow model: model.pb!
T Traceback (most recent call last):
T   File "rknn/api/rknn_base.py", line 143, in rknn.api.rknn_base.RKNNBase.load_tensorflow
T   File "rknn/base/rknnlib/converter/convert_tf.py", line 93, in rknn.base.rknnlib.converter.convert_tf.convert_tf.__init__
T   File "rknn/base/rknnlib/converter/tensorflowloader.py", line 53, in rknn.base.rknnlib.converter.tensorflowloader.TF_Graph_Preprocess.__init__
T AttributeError: 'NoneType' object has no attribute 'op'
done
--> Building model
model_input or data_input or model_quantize is None, please check it.
done
回复

使用道具 举报

qiaoqiang126

中级会员

积分
225
地板
 楼主| 发表于 2019-2-15 10:54:28 | 显示全部楼层
我的输入是这样子的input_size_list=[[96, 300, 1]])
设置是这样子的rknn.config(channel_mean_value='0 0 0 255', reorder_channel='0 1 2')  是不是需要改动?
回复

使用道具 举报

qiaoqiang126

中级会员

积分
225
5#
 楼主| 发表于 2019-2-15 11:10:46 | 显示全部楼层
I Have 16 tensors convert to const tensor
['cell_op1/bidirectional_rnn/fw/fw/LSTMCellZeroState/zerosut0', 'cell_op1/bidirectional_rnn/fw/fw/LSTMCellZeroState/zeros_1ut0', 'pool1ut0', 'cell_op2/bidirectional_rnn/bw/bw/LSTMCellZeroState/zerosut0', 'Reshape_6/shapeut0', 'Reshape_3/shapeut0', 'cell_op2/bidirectional_rnn/bw/bw/LSTMCellZeroState/zeros_1ut0', 'cell_op1/bidirectional_rnn/bw/bw/LSTMCellZeroState/zerosut0', 'cell_op1/bidirectional_rnn/bw/bw/LSTMCellZeroState/zeros_1ut0', 'Cast_1ut0', 'sub:out0', 'Cast:out0', 'sub_1:out0', 'cell_op2/bidirectional_rnn/fw/fw/LSTMCellZeroState/zeros_1:out0', 'Tile:out0', 'cell_op2/bidirectional_rnn/fw/fw/LSTMCellZeroState/zeros:out0']
I build output layer attach_out:out0
I build input layer inputqq:out0
I Try match Identity out
I Match [['out']] [['Identity']] to [['noop']]
I Try match Reshape biril2
I Match [['biril2', 'biril2/shape']] [['Reshape', 'C']] to [['reshape']]
I Try match Add add_11
I Match [['Variable_22', 'add_11', 'MatMul_4', 'Variable_23']] [['Add', 'MatMul', 'C', 'C_1']] to [['fullconnect']]
I Try match Reshape Reshape_17
I Match [['Reshape_17', 'Reshape_17/shape']] [['Reshape', 'C']] to [['reshape']]
I Try match Reshape Reshape_16
I Match [['Reshape_16', 'Reshape_16/shape']] [['Reshape', 'C']] to [['reshape']]
I Try match Reshape Reshape_15
I Match [['Reshape_15', 'Reshape_15/shape']] [['Reshape', 'C']] to [['reshape']]
I Try match ConcatV2 concat_1
W Not match node concat_1 ConcatV2
E Catch exception when loading tensorflow model: model_1.pb!
T Traceback (most recent call last):
T   File "rknn/api/rknn_base.py", line 191, in rknn.api.rknn_base.RKNNBase.load_tensorflow
T   File "rknn/base/rknnlib/converter/convert_tf.py", line 533, in rknn.base.rknnlib.converter.convert_tf.convert_tf.match_paragraph_and_param
T   File "rknn/base/rknnlib/converter/convert_tf.py", line 438, in rknn.base.rknnlib.converter.convert_tf.convert_tf._tf_push_ready_node
T TypeError: 'NoneType' object is not iterable
done
--> Building model
model_input or data_input or model_quantize is None, please check it.
done
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

产品中心 购买渠道 开源社区 Wiki教程 资料下载 关于Toybrick


快速回复 返回顶部 返回列表