Toybrick

如何把mars-small128.pb转为rknn

18958105257

注册会员

积分
94
楼主
发表于 2019-9-24 14:19:31    查看: 11057|回复: 3 | [复制链接]    打印 | 只看该作者
各位好,
如何把mars-small128.pb转为rknn;有没有写好的.py文件;我改了一个,运行的时候总是报错;
使用mars-small128.pb没有用RK3399pro的npu,跟踪起来很卡,想把npu用起来;

from PIL import Image
import numpy as np
#from matplotlib import pyplot as plt

import re
import math
import random

from rknn.api import RKNN


if __name__ == '__main__':

    # Create RKNN object
    rknn = RKNN()

    # Load tensorflow model
    print('--> Loading model')
    rknn.load_tensorflow(tf_pb='mars-small128.pb',inputs=['image','boxes'],outputs=['features'],input_size_list=[[416, 416, 3]])

    print('done')

    rknn.config(channel_mean_value='0 0 0 255', reorder_channel='0 1 2')

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

    rknn.export_rknn('./mars-small128.rknn')

    exit(0)
~                  


报错信息如下

W:tensorflow:
The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
  * https://github.com/tensorflow/co ... 7-contrib-sunset.md
  * https://github.com/tensorflow/addons
  * https://github.com/tensorflow/io (for I/O related ops)
If you depend on functionality not listed there, please file an issue.

W:tensorflow:From /home/zg/.local/lib/python3.5/site-packages/onnx_tf/handlers/backend/is_nan.py:9: The name tf.is_nan is deprecated. Please use tf.math.is_nan instead.

W:tensorflow:From /home/zg/.local/lib/python3.5/site-packages/onnx_tf/handlers/backend/log.py:10: The name tf.log is deprecated. Please use tf.math.log instead.

W:tensorflow:From /home/zg/.local/lib/python3.5/site-packages/onnx_tf/handlers/backend/upsample.py:13: The name tf.image.resize_images is deprecated. Please use tf.image.resize instead.

/home/zg/.local/lib/python3.5/site-packages/onnx_tf/common/__init__.py:87: UserWarning: FrontendHandler.get_outputs_names is deprecated. It will be removed in future release.. Use node.outputs instead.
  warnings.warn(message)
--> Loading model
E length of input_size_list is not equal to inputs
E Catch exception when loading tensorflow model: mars-small128.pb!
T Traceback (most recent call last):
T   File "rknn/api/rknn_base.py", line 135, in rknn.api.rknn_base.RKNNBase.load_tensorflow
T   File "rknn/base/RKNNlib/converter/convert_tf.py", line 89, in rknn.base.RKNNlib.converter.convert_tf.convert_tf.__init__
T   File "/home/zg/.local/lib/python3.5/site-packages/rknn/base/RKNNlib/RKNNlog.py", line 267, in e
T     raise ValueError(msg)
T ValueError: length of input_size_list is not equal to inputs
done
--> Building model
Traceback (most recent call last):
  File "rknn_transform_mars128.py", line 27, in <module>
    rknn.build(do_quantization=False,pre_compile=False)
  File "/home/zg/.local/lib/python3.5/site-packages/rknn/api/rknn.py", line 163, in build
    inputs = self.rknn_base.net.get_input_layers()
AttributeError: 'NoneType' object has no attribute 'get_input_layers'


回复

使用道具 举报

w910820618

注册会员

积分
118
沙发
发表于 2019-12-16 10:25:03 | 只看该作者
我也有同样的错误,请问你已经解决了吗?是否可以讨论一下呢
回复

使用道具 举报

YP-gcg

新手上路

积分
6
板凳
发表于 2020-1-20 15:30:17 | 只看该作者
你好,我也想在npu上跑deepsort,请问你现在解决mars-small128转模型的问题了吗,能加个微信请教下吗?
gcg2008
回复

使用道具 举报

jefferyzhang

版主

积分
13578
地板
发表于 2020-1-25 08:49:36 | 只看该作者
E length of input_size_list is not equal to inputs
rknn.load_tensorflow 参数用错了,你这里有两个input,但却只有一个input_size_list
回复

使用道具 举报

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

本版积分规则

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


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