Toybrick RK1808 User Manual

http://t.rock-chips.com/en
Page 1 of 32
V1.2.0
Page 2 of 32
Table of Contents
1 OVERVIEW ..................................................................................................................................................... 3
2 SPECIFICATION ........................................................................................................................................... 4
2.1 MINI-SYSTEM REQUIREMENT ............................................................................................................... 4
3 DOCUMENT DESCRIPTION ................................................................................................................. 5
4 GETTING START .................................................................................................................................... 6
4.1 ENVIRONMENT PREPARATION ............................................................................................................... 6
4.2 RKNN-TOOLKIT INSTALLATION .......................................................................................................... 6
4.3 DEVICE ACCESS PERMISSION MODIFICATION ........................................................................................ 8
4.4 RUNNING DEMO ON RK1808 AI COMPUTE STICK................................................................................. 9
5 WEB CONFIGURATION ...................................................................................................................... 12
5.1 THE HOST NETWORK CONFIGURATION .............................................................................................. 12
5.2 WEB LOGIN .......................................................................................................................................... 17
5.3 INTRODUCTION OF MAIN FUNCTIONS OF WEB PAGES ...................................................................... 18
6 SLAVE MODE DEVELOPMENT......................................................................................................... 25
7 MASTER MODE DEVELOPMENT .................................................................................................... 27
7.1 AI DEVELOPMENT PROCESS INTRODUCTION UNDER HOST MODE ......................................................................... 28
7.2 DEVELOPMENT TOOL TOYBRICK_DEPLOYC ..................................................................................................... 28
7.2.1 Development tool toybrick_deployc command list and command illustration ............................. 28
7.2.2 Development process based on Toybrick platform ........................................................................ 31
7.2.3 Introduction of product deployment .............................................................................................. 32
Page 3 of 32
1 Overview
TB-RK1808 AI compute stick is Rockchip's Toybrick series. It is equipped with
Rockchip's RK1808 neural network processor. It has low power consumption and high
performance, and can be applied to various application fields of artificial intelligence. . The
Host can obtain powerful deep learning and inference ability through the RK1808 AI compute
stick. With the powerful computing power of the RK1808 AI compute stick, embedded
devices can build AI algorithms on the edge of the network, making it easy for traditional
embedded devices to upgrade artificial intelligence.
RK1808 AI compute stick can be used to assist inference calculation, and also supports
independent AI compute function through secondary development.
Page 4 of 32
2 Specification
Specification
CPU
RK1808
Memory
1GB LPDDR
Storage
8GB EMMC
Interface
USB3.0 Type-A
Temperature
0~40
Size
82x31x13mm
2.1 Mini-system requirement
Ubuntu 16.04 or x86_64 PC CPU intel core i3 USB 3.0 2 GB RAM 4 GB Storage
Page 5 of 32
3 Document description
Plug the RK1808 AI compute stick into the USB port of PC, and the usb device will be
displayed on the PC. The directory structure and document description of the usb device is as
follows:
Directory
Document
Description
doc
RK1808_RKNN_SDK_DEVELOPER_GUIDE_EN.pdf
The guide of RK1808 RKNN SDK
programming for C API and python
API.
RK1808_RKNN_SDK_DEVELOPER_GUIDE_CN.pdf
RK3399Pro_Linux&Android_RKNN_API_EN.pdf
The guide of RKNN SDK
programming for C API in the Host. RK3399Pro_Linux&Android_RKNN_API_CN. pdf
RKNN_Toolkit User_Guide_EN. pdf
RKNN-Toolkit and python API user
guide. RKNN_Toolkit User_Guide_CN.pdf
RK1808_AI_Compute_Stick_User_manual_EN.pdf
RK1808 AI compute stick user
manual. RK1808_AI_Compute_Stick_User_manual_CN.pdf
RK1808_AI_Compute_Stick_Easy_Start_Demo_Guide_EN.pdf
The guide of Easy start yovov3
demo. RK1808_AI_Compute_Stick_Easy_Start_Demo_Guide_CN.pdf
driver
ntb
USB ntd windows driver.
example
mobilenet_v1
Mobilenet demo.
yolov3
The guide of Easy start yovov3
demo.
rknn
Npu_transfer_proxy
RKNN-Toolkit the Host
communication agenda.
Rknn-api
The Host C library and head file for
RKNN SDK programming.
Rknn-toolkit
RKNN-Toolkit installation
package.
tool
Script and tool.
Page 6 of 32
4 Getting start
This section describes an example of how the RK1808 AI compute stick can run
mobilenet_v1 quickly on a Ubuntu 18.04 PC based on python 3.6 using RKNN-Toolkit.
4.1 Environment preparation
A computer with ubuntu 18.04. RK1808 AI compute stick. Plug RK1808 AI compute stick into the USB port of PCand input lsusb command to
view the results (The line be marked in red , 2207:1800 is TB-RK1808S0's ID)
1) Enter the following command:
lsusb
2) The execution result as shown below:
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 009: ID 2207:1800
4.2 RKNN-Toolkit installation
RKNN-Toolkit is a software development kit for users to perform model conversion,
inference and performance evaluation base on python interface.
In this section, we will show how to install RKNN-Toolkit in a X86_64 PC with ubuntu
18.04 and python 3.6. perform the following command:
Install Python3.6
sudo apt-get install python3.6
Install pip3
sudo apt-get install python3-pip
Plug the RK1808 AI compute stick into the USB port of PC, and the usb device will be
Page 7 of 32
displayed on the PC. The directory structure of the usb device is as follows:
Perform the following steps
1. Enter root directory of U disk:
2. Enter rknn/rknn-toolkit/ directory.
cd rknn/rknn-toolkit/
3. Install Python requirement
pip3 install --user -r requirements-ubuntu18.04-python3.6.txt
4. Install RKNN-Toolkit
pip3 install --user rknn_toolkit-1.1.0b1-cp36-cp36m-linux_x86_64.whl
Notice: RKNN-Toolkit must match with python version, the default version for ubuntu18.04 is python3.6.
5. Check whether the rknn-toolkit has been successfully installed:
1) Enter the following command:
python3
2) Enter the following code in python3 running environment to import RKNN module.
from rknn.api import RKNN
(1) If RKNN has been imported successfully:
$ python3 >>> from rknn.api import RKNN >>>
(2) Input quit(), quit from the Python, and Skip the following (3) steps.
(3) If report the following error after import RKNN, it was because the installation
package for Tensorflow that RKNN relies on uses the SSE4.2 instruction set and the
Page 8 of 32
CPU can’t support those instruction set. So please change a computer which supports
SSE4.2 instruction set.
$ python3 >>> from rknn.api import RKNN 2019-06-25 20:10:25.255397: F tensorflow/core/platform/cpu_feature_guard.cc:37] The TensorFlow library was compiled to use SSE4.2 instructions, but these aren't available on your machine.
4.3 Device access permission modification
1. Plug RK1808 AI compute stick into the USB port of PC, follow these steps to modify
the USB device access permissions
1) Back to U disk root directory, copy “tool/update_rk1808_ai_cs_rule.sh” to “/tmp”
directory. Modify update_rk1808_ai_cs_rule.sh with executable permission.
2) update_rk1808_ai_cs_rule.sh must be executed with root authority.
sudo /tmp/update_rk1808_ai_cs_rule.sh
Notice: This step only need to be executed once during installation and does not need to be executed later.
2. After executing the script, use the lsusb command to view the device number of the TB-
1808S0.
1) Input the following command:
lsusb
2) The execution result as shown below:
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 009: ID 2207:0018
Notice: 'Bus 003 Device 009', '003' and '009' represent bus and device number,
3. We can check the read and write permissions of the RK1808 AI compute stick.
1) Input the following command:
Page 9 of 32
ls -l /dev/bus/usb/003/009
Notice: “003/009”it's not fixed, please get right bus&device number by lsusb command according to your own situation.
2) The execution result as shown below (The correct read and write permissions are
shown in the red mark):
crw-rw-rw- 1 root root 189, 264 6 14 16:02 /dev/bus/usb/003/009
4.4 Running demo on RK1808 AI compute stick
This section we will take mobilenet_v1 for example, to show how to use RK1808 AI
compute stick. Mobilenet_v1 can realize feature extraction of an image and identification of
the classification of the image.
The mobilenet_v1 demo directory structure and description are as follow
dataset.txt: a text file containing the test image path. dog_224x224.jpg: test image. mobilenet_v1.tflite: TensorFlow Lite model file. mobilenet_v1.rknn: rknn model file. Generated by non-rknn modelthere is TensorFlow
Lite modelthrough the rknn-toolkit convert.
test.py: running script(include rknn model conversion script). test_inference.py: running scriptonly use to load the rknn model for inference.
Running this demo on RK1808 AI compute stick follow below steps:
Page 10 of 32
1. Back to U disk root directory, copy example/mobilenet_v1 directory to /tmp, then switch
to this directory
cp -rf example/mobilenet_v1/ /tmp/ cd /tmp/mobilenet_v1/
2. Execute test.py and get the following results: python3.6 test.py
--> config model done
--> Loading model done
--> Building model done
--> Export RKNN model done
--> Init runtime environment done
--> Running model mobilenet_v1
-----TOP 5----­[156]: 0.8837890625 [155]: 0.0677490234375 [188 205]: 0.00867462158203125 [188 205]: 0.00867462158203125 [263]: 0.0057525634765625
done
--> Begin evaluate model performance ======================================================================== Performance ======================================================================== Total Time(us): 7320 FPS: 136.61 ========================================================================
done
According to the above execution results, TOP5 represents the results of the top 5
Loading...
+ 22 hidden pages