Toybrick

标题: 多输入模型转换问题 [打印本页]

作者: lijingle    时间: 2020-3-20 16:01
标题: 多输入模型转换问题
下面是我模型的输入输出信息

Found 3 possible inputs: (name=Placeholder, type=float(1), shape=[32,1024,3]) (name=Placeholder_1, type=int32(3), shape=[32]) (name=Placeholder_2, type=bool(10), shape=[])
No variables spotted.
Found 1 possible outputs: (name=SparseSoftmaxCrossEntropyWithLogits/SparseSoftmaxCrossEntropyWithLogits, op=SparseSoftmaxCrossEntropyWithLogits)
Found 3496475 (3.50M) const parameters, 0 (0) variable parameters, and 178 control_edges
36 nodes assigned to device '/device:CPU:0'1077 nodes assigned to device '/device:GPU:0'Op types used: 249 Identity, 218 Const, 210 Switch, 122 Sub, 91 Mul, 53 Merge, 40 Add, 35 Squeeze, 34 NoOp, 34 Mean, 20 BiasAdd, 17 SquaredDifference, 17 Rsqrt, 17 Relu, 17 StopGradient, 11 Conv2D, 9 MatMul, 5 Reshape, 3 MaxPool, 3 Placeholder, 3 RealDiv, 3 Floor, 3 ExpandDims, 2 BatchMatMul, 2 RandomUniform, 1 SparseSoftmaxCrossEntropyWithLogits, 1 Pow, 1 Minimum, 1 Cast
To use with tensorflow/tools/benchmark:benchmark_model try these arguments:
bazel run tensorflow/tools/benchmark:benchmark_model -- --graph=./good_frozen.pb --show_flops --input_layer=Placeholder,Placeholder_1,Placeholder_2 --input_layer_type=float,int32,bool --input_layer_shape=32,1024,3:32: --output_layer=SparseSoftmaxCrossEntropyWithLogits/SparseSoftmaxCrossEntropyWithLogits



我要进行模型转化时input_size_list=应该怎么写,可以给个例子吗,下面我的转换脚本


from rknn.api import RKNN  

INPUT_SIZE = 1024

if __name__ == '__main__':
    rknn = RKNN()
    rknn.config(channel_mean_value='0 0 0 255', reorder_channel='0 1 2')

    print('--> Loading model')
    rknn.load_tensorflow(tf_pb='good_frozen.pb',
                         inputs=['Placeholder','Placeholder_1','Placeholder_2'],
                         outputs=['SparseSoftmaxCrossEntropyWithLogits/SparseSoftmaxCrossEntropyWithLogits'],
                         input_size_list=[[32,1024,3]])
    print('done')

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

    rknn.export_rknn('./digital_gesture.rknn')

    rknn.release()








不然报错
--> Loading model
E length of input_size_list is not equal to inputs
E Catch exception when loading tensorflow model: good_frozen.pb!
E Traceback (most recent call last):
E   File "rknn/api/rknn_base.py", line 137, in rknn.api.rknn_base.RKNNBase.load_tensorflow
E   File "rknn/base/RKNNlib/converter/convert_tf.py", line 89, in rknn.base.RKNNlib.converter.convert_tf.convert_tf.__init__
E   File "/home/toybrick/.local/lib/python3.7/site-packages/rknn/base/RKNNlib/RKNNlog.py", line 327, in e
E     raise ValueError(msg)
E ValueError: length of input_size_list is not equal to inputs
done
--> Building model
Traceback (most recent call last):
  File "convert.py", line 17, in <module>
    rknn.build(do_quantization=False)
  File "/home/toybrick/.local/lib/python3.7/site-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'


作者: leok    时间: 2020-3-21 16:06
参照文档: https://github.com/rockchip-linu ... olkit_V1.3.0_CN.pdf




欢迎光临 Toybrick (https://t.rock-chips.com/) Powered by Discuz! X3.3