|
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()
|
|