Toybrick

含有自定义算子的rknn在rk3399pro上init runtime初始化失败

liufeng

中级会员

积分
228
楼主
发表于 2020-8-7 17:23:44    查看: 5419|回复: 3 | [复制链接]    打印 | 只看该作者
toybrick@debian10:~/rknn-toolkit-v1.3.2/examples/common_function_demos/custom_op/ts$ python3 rknn_custom_op_resize_area.py
--> 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`
/home/toybrick/.local/lib/python3.7/site-packages/rknn/api/rknn.py:67: FutureWarning: Possible nested set at position 7
  std_values=std_values)
done
-->Building model
W The target_platform is not set in config, using default target platform rk1808.
W Custom op sign
W Custom op sign
done
-->exporting rknn
done
-->loading rknn
done
-->initing runtime
I NPUTransfer: Starting NPU Transfer Client, Transfer version 1.9.8 (40e4a8a@2020-01-02T09:16:20)
E RKNNAPI: rknn_init,  msg_load_ack fail, ack = 1(ACK_FAIL), expect 0(ACK_SUCC)!
E RKNNAPI: ==============================================
E RKNNAPI: RKNN VERSION:
E RKNNAPI:   API: 1.3.2 (9eebd73 build: 2020-04-02 15:30:36)
E RKNNAPI:   DRV: 1.3.0 (c4f8c23 build: 2019-11-25 10:39:29)
E RKNNAPI: ==============================================
E Catch exception when init runtime!
E Traceback (most recent call last):
E   File "rknn/api/rknn_base.py", line 1067, in rknn.api.rknn_base.RKNNBase.init_runtime
E   File "rknn/api/rknn_runtime.py", line 326, in rknn.api.rknn_runtime.RKNNRuntime.build_graph
E Exception: RKNN init failed. error code: RKNN_ERR_MODEL_INVALID
Init runtime environment failed

自定义算子Sign.rknnop的生成在linux下完成,推理时候init_runtime出错。代码如下:

import cv2
import numpy as np
from rknn.api import RKNN

INPUT_SIZE = 1

if __name__ == '__main__':

    rknn = RKNN(verbose=False)

    rknn.register_op('./Sign/Sign.rknnop')
    print('--> Loading model')
    rknn.load_tensorflow(tf_pb='./ts-sign.pb',
                         inputs=['input_holder'],
                         outputs=['predictions'],
                         input_size_list=[[INPUT_SIZE, INPUT_SIZE,3]])
    print('done')
    print('--> Building model')
    rknn.build(do_quantization=False)
    print('done')
    rknn.export_rknn('./Sign.rknn')
    rknn.init_runtime()






回复

使用道具 举报

liufeng

中级会员

积分
228
沙发
 楼主| 发表于 2020-8-7 17:27:24 | 只看该作者
请专家来解答,是版本问题吗
回复

使用道具 举报

liufeng

中级会员

积分
228
板凳
 楼主| 发表于 2020-8-10 10:13:46 | 只看该作者
如果没有用自定义算子是可以在开发板上推理的,自定义信号函数的过程没有问题,编译也是通过的。哪位朋友解决了这个问题,如何解决的,谢谢知道的帮忙看一下呢,谢谢。
回复

使用道具 举报

liufeng

中级会员

积分
228
地板
 楼主| 发表于 2020-8-10 10:15:11 | 只看该作者
有什么提示性的参考建议吗?
回复

使用道具 举报

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

本版积分规则

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


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