【RKNN Toolkit 1.6.0】在PC端的Ubuntu16.04中安装RKNN Toolkit 1.6.0开发环境

1. 背景目标

利用RK3399pro平台,移植深度学习目标检测算法,实现嵌入式平台的深度学习应用
本文在PC端的Ubuntu16.04中安装RKNN Toolkit 1.6.0开发环境,方便模型转换(例如从tensorflow平台下的.pb文件转换为RK平台下需要的.rknn文件)

2. 实操步骤

2.1 利用conda创建新的环境
conda create -n [name] #创建名为name的conda环境,如tensorflow
source activate [name]     #激活刚才创建的环境,命令完成后,回答先命令行之前多了刚创建的环境的名字

2.2 依赖包和环境要求:

在这里插入图片描述

2.3 安装RKNN1.6.0和相关依赖包

(1)离线whl包均从rockcip官方源下载,链接如下:http://repo.rock-chips.com/pypi/simple/

  • 离线包名称:rknn_toolkit-1.6.0-cp36-cp36m-linux_x86_64.whl

(2)将下载的离线包利用pip进行安装,因为利用conda install无法安装

  • 使用pip将对应的包安装在指定的conda环境的指定的python目录下;
  • 注意:如果直接使用pip install,会存在问题,将会同时安装在多个不同环境的python下;
  • 执行该pip时候,需要在rknn_toolkit-1.6.0-cp36-cp36m-linux_x86_64.whl文件所在目录下:
python3.6 -m pip install -t 相关目录/anaconda3/envs/rknn_1.6/lib/python3.6/site-packages/ rknn_toolkit-1.6.0-cp36-cp36m-linux_x86_64.whl

执行该指令后,就会同时下载必要的依赖包。

2.4 运行官方提供的demo,测试RKNN是否安装成功

从官方github仓下载 rknn-toolkit-v1.6.0-packages
https://github.com/rockchip-linux/rknn-toolkit

python3 test.py
--> Config model
done
--> Loading model
W The target_platform is not set in config, using default target platform rk1808.
W:tensorflow:From /home/user/venv/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py:1814: py_func (from tensorflow.python.ops.script_ops) is deprecated and will be removed in a future version.
Instructions for updating:
tf.py_func is deprecated in TF V2. Instead, there are two
    options available in V2.
    - tf.py_function takes a python function which manipulates tf eager
    tensors instead of numpy arrays. It's easy to convert a tf eager tensor to
    an ndarray (just call tensor.numpy()) but having access to eager tensors
    means `tf.py_function`s can use accelerators such as GPUs as well as
    being differentiable using a gradient tape.
    - tf.numpy_function maintains the semantics of the deprecated tf.py_func
    (it is not differentiable, and manipulates numpy arrays). It drops the
    stateful argument making all functions stateful.
    
done
--> Export RKNN model
done
--> Init runtime environment
done
--> Running model
done
--> Evaluate model performance
W When performing performance evaluation, inputs can be set to None to use fake inputs.
========================================================================
                               Performance                              
========================================================================
Layer ID    Name                                         Time(us)
57          openvx.tensor_transpose_3                    125
117         convolution.relu.pooling.layer2_2            204
115         convolution.relu.pooling.layer2_2            404
112         convolution.relu.pooling.layer2_2            416
110         convolution.relu.pooling.layer2_2            597
107         convolution.relu.pooling.layer2_2            245
105         convolution.relu.pooling.layer2_2            503
...         ...                                          ...
23          fullyconnected.relu.layer_3                  13
29          fullyconnected.relu.layer_3                  8
Total Time(us): 10218
FPS(600MHz): 73.40
FPS(800MHz): 97.87
Note: Time of each layer is converted according to 800MHz!
========================================================================

done

3. 其他相关博客

【RKNN-Toolkit-Tensorflow】得到不同模型的box_priors.txt文件(如:rknn-toolkit\example\mobilenet-ssd中)

  • 4
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值