Toybrick

楼主: candela4rk

模型推理遇到问题

candela4rk

注册会员

积分
91
11#
 楼主| 发表于 2020-5-20 10:12:19 | 显示全部楼层
addy 发表于 2020-5-19 18:27
执行命令:npu_transfer_devices
确认下设备是否存在。

我更新驱动以后,npu_transfer_proxy devices输出:
List of ntb devices attached
9cd15daa2683fa8f    2c41d4f0    USB_DEVICE

C++代码输出:
D RKNNAPI: ==============================================
D RKNNAPI: RKNN VERSION:
D RKNNAPI:   API: 1.3.0 (c5654ea build: 2019-12-25 14:12:00)
D RKNNAPI:   DRV: 1.3.1 (6ebb4d7 build: 2020-01-02 09:37:58)
D RKNNAPI: ==============================================
api version: 1.3.0 (c5654ea build: 2019-12-25 14:12:00)
driver version: 1.3.1 (6ebb4d7 build: 2020-01-02 09:37:58)
n_devices = 1
0: type=USB_DEVICE, id=9cd15daa2683fa8f

wiki的推理程序报错:
-->loading model
loading model done
--> Init runtime environment
E Only support ntb mode on ARM64 platform. But can not find device with ntb mode.
E Catch exception when init runtime!
E Traceback (most recent call last):
E   File "rknn/api/rknn_base.py", line 1042, in rknn.api.rknn_base.RKNNBase.init_runtime
E   File "rknn/api/rknn_runtime.py", line 168, in rknn.api.rknn_runtime.RKNNRuntime.__init__
E   File "rknn/api/rknn_platform_utils.py", line 285, in rknn.api.rknn_platform_utils.start_ntp_or_adb
E Exception: Init runtime environment failed!
E Current device id is: 9cd15daa2683fa8f
E Devices connected:
E ['9cd15daa2683fa8f']
Init runtime environment failed
回复

使用道具 举报

candela4rk

注册会员

积分
91
12#
 楼主| 发表于 2020-5-20 10:30:48 | 显示全部楼层
jefferyzhang 发表于 2020-5-19 17:33
从你lsusb结果来看都是正常的。
请问下你的开发版是谁家的,型号是什么,系统是什么,是3399pro还是1808计 ...

回到开始的问题了,模型转换也出错了:
--> Loading model
W:tensorflow:From /home/toybrick/.local/lib/python3.7/site-packages/onnx_tf/handlers/backend/ceil.py:10: The name tf.ceil is deprecated. Please use tf.math.ceil instead.

W:tensorflow:From /home/toybrick/.local/lib/python3.7/site-packages/onnx_tf/handlers/backend/depth_to_space.py:12: The name tf.depth_to_space is deprecated. Please use tf.compat.v1.depth_to_space instead.

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/toybrick/.local/lib/python3.7/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/toybrick/.local/lib/python3.7/site-packages/onnx_tf/handlers/backend/random_normal.py:9: The name tf.random_normal is deprecated. Please use tf.random.normal instead.

W:tensorflow:From /home/toybrick/.local/lib/python3.7/site-packages/onnx_tf/handlers/backend/random_uniform.py:9: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.

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

/home/toybrick/.local/lib/python3.7/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)
W:tensorflow:From /home/toybrick/.local/lib/python3.7/site-packages/rknn/api/rknn.py:67: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.extract_sub_graph`
E Catch exception when loading tensorflow model: tiny-yolo-voc.pb!
E Traceback (most recent call last):
E   File "rknn/api/rknn_base.py", line 215, in rknn.api.rknn_base.RKNNBase.load_tensorflow
E   File "rknn/base/RKNNlib/converter/convert_tf.py", line 527, in rknn.base.RKNNlib.converter.convert_tf.convert_tf.pre_process
E   File "rknn/base/RKNNlib/converter/tensorflowloader.py", line 96, in rknn.base.RKNNlib.converter.tensorflowloader.TF_Graph_Preprocess.pre_proces
E   File "rknn/base/RKNNlib/converter/tensorflowloader.py", line 555, in rknn.base.RKNNlib.converter.tensorflowloader.TF_Graph_Preprocess.import_tf_ruler_module
E   File "/home/toybrick/.local/lib/python3.7/site-packages/rknn/base/RKNNlib/converter/tfruler/__init__.py", line 2, in <module>
E     from .tf_ruler_generate import r_add_n_template, r_concatv2_template, r_split_template
E ImportError: cannot import name 'r_add_n_template' from 'tfruler.tf_ruler_generate' (/home/toybrick/.local/lib/python3.7/site-packages/rknn/base/RKNNlib/converter/tfruler/tf_ruler_generate.cpython-37m-aarch64-linux-gnu.so)
done
--> Building model
Traceback (most recent call last):
  File "ex.py", line 32, in <module>
    rknn.build(do_quantization=False)
  File "/home/toybrick/.local/lib/python3.7/site-packages/rknn/api/rknn.py", line 222, in build
    inputs = self.rknn_base.net.get_input_layers()
AttributeError: 'NoneType' object has no attribute 'get_input_layers'
回复

使用道具 举报

candela4rk

注册会员

积分
91
13#
 楼主| 发表于 2020-5-20 11:14:09 | 显示全部楼层
本帖最后由 candela4rk 于 2020-5-20 11:20 编辑
jefferyzhang 发表于 2020-5-20 10:54
E     from .tf_ruler_generate import r_add_n_template, r_concatv2_template, r_split_template
E Impor ...

应该是这个问题了,我用toolkit里面的mobilenet_v1可以跑推理。
还有个问题是:为什么我没更新驱动和api之前是可以转换的,不提示op相关的错误呢?
又有个问题:我用ret = rknn.init_runtime()没问题,用rknn.init_runtime(target='rk3399pro', device_id='9cd15daa2683fa8f')就报错
Only support ntb mode on ARM64 platform. But can not find device with ntb mode

回复

使用道具 举报

candela4rk

注册会员

积分
91
14#
 楼主| 发表于 2020-5-20 11:27:00 | 显示全部楼层
jefferyzhang 发表于 2020-5-20 11:21
cannot import name 'r_add_n_template' from 'tfruler.tf_ruler_generate
这里看过去是没有这个函数的实 ...

我发现rknn.init_runtime(target='rk1808')和rknn.init_runtime()是可以跑的,rknn.init_runtime(target='rk3399pro')报错
Only support ntb mode on ARM64 platform. But can not find device with ntb mode
可我是rk3399pro,不是插的棒子啊......
回复

使用道具 举报

candela4rk

注册会员

积分
91
15#
 楼主| 发表于 2020-5-20 13:51:59 | 显示全部楼层
jefferyzhang 发表于 2020-5-20 11:40
本地运行不需要写target

好的,多谢耐心答疑。
回复

使用道具 举报

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

本版积分规则

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


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