Toybrick

rknn模型转换失败

qiaoqiang126

中级会员

积分
225
楼主
发表于 2019-1-29 18:11:21    查看: 9188|回复: 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'


有什么解决办法吗?




回复

使用道具 举报

zhangzj

超级版主

积分
1117
沙发
发表于 2019-1-30 08:48:50 | 只看该作者
pb文件发出来看下
回复

使用道具 举报

qiaoqiang126

中级会员

积分
225
板凳
 楼主| 发表于 2019-1-30 09:42:42 | 只看该作者
文件里是pb模型的结构和具体节点名称,大小                       pb文件能上传吗?太大了

本帖子中包含更多资源

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

x
回复

使用道具 举报

zhangzj

超级版主

积分
1117
地板
发表于 2019-2-15 09:16:48 | 只看该作者
用0.9.8版本rknn-toolkit,把转换信息开起来,看看报什么错

0.9.8版本下载地址:
https://pan.baidu.com/s/1ypkndmI7P62W8DWf0AW5ew 提取码: qhhy

调试信息打印方法:
初始化RKNN对象时,设置verbose参数为true,详细信息请参考文档说明

回复

使用道具 举报

qiaoqiang126

中级会员

积分
225
5#
 楼主| 发表于 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
6#
 楼主| 发表于 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
7#
 楼主| 发表于 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
回复

使用道具 举报

慢慢的大米饭

新手上路

积分
43
8#
发表于 2019-2-15 11:32:14 | 只看该作者
zhangzj 发表于 2019-2-15 09:16
用0.9.8版本rknn-toolkit,把转换信息开起来,看看报什么错

0.9.8版本下载地址:

已经换0.9.8 caffe模型转换,报错如下请帮忙查找

usr/lib64/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.

  from ._conv import register_converters as _register_converters

--> Init runtime environment

done

--> Loading model

W Unknown caffe layer detectionoutput

E Invalid tensor id(1), tensor(@mbox_conf_flatten_217ut0)

E Catch exception when loading caffe model: ./modelconfig.prototxt!

T Traceback (most recent call last):

T   File "rknn/api/rknn_base.py", line 257, in rknn.api.rknn_base.RKNNBase.load_caffe

T   File "rknn/base/rknnlib/converter/caffeloader.py", line 969, in rknn.base.rknnlib.converter.caffeloader.CaffeLoader.load

T   File "rknn/base/rknnlib/converter/caffeloader.py", line 882, in rknn.base.rknnlib.converter.caffeloader.CaffeLoader.parse_connections

T   File "rknn/base/rknnlib/rknnnet.py", line 270, in rknn.base.rknnlib.rknnnet.rknnNet.connect

T   File "rknn/base/rknnlib/layer/rknnlayer.py", line 141, in rknn.base.rknnlib.layer.rknnlayer.rknnLayer.add_input

T   File "rknn/base/rknnlib/layer/rknnlayer.py", line 26, in rknn.base.rknnlib.layer.rknnlayer.IoStruct.add

T   File "rknn/base/rknnlib/rknnlog.py", line 105, in rknn.base.rknnlib.rknnlog.rknnLog.e

T ValueError: Invalid tensor id(1), tensor(@mbox_conf_flatten_217ut0)

done

--> Building model

done
回复

使用道具 举报

zht

注册会员

积分
74
9#
发表于 2019-2-28 15:45:14 | 只看该作者
proposal這一層改一下:

layer {
  name: 'proposal'
  type: 'proposal'
  bottom: 'rpn_cls_prob_reshape'
  bottom: 'rpn_bbox_pred'
  top: 'rois'
  top: 'scores'
    proposal_param {
    ratio: 0.5 ratio: 1.0 ratio: 2.0
    scale: 8 scale: 16 scale: 32
    base_size: 16
    feat_stride: 16
    pre_nms_topn: 6000
    post_nms_topn: 300
    nms_thresh: 0.7
    min_size: 16

  }
}
回复

使用道具 举报

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

本版积分规则

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


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