Toybrick RK1808 User manual

http://t.rock-chips.com/en
Page 1 of 32
RK1808 AI Compute Stick User manual
V1.2.0

Page 2 of 32
Table of Contents
1OVERVIEW..................................................................................................................................................... 3
2SPECIFICATION........................................................................................................................................... 4
2.1 MINI-SYSTEM REQUIREMENT ............................................................................................................... 4
3DOCUMENT DESCRIPTION................................................................................................................. 5
4GETTING 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
5WEB CONFIGURATION ...................................................................................................................... 12
5.1 THE HOST NETWORK CONFIGURATION.............................................................................................. 12
5.2 WEB LOGIN .......................................................................................................................................... 17
5.3 INTRODUCTION OF MAIN FUNCTIONS OF WEB PAGES ...................................................................... 18
6SLAVE MODE DEVELOPMENT......................................................................................................... 25
7MASTER 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
1Overview
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
2Specification
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 PC,and 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 model(there is TensorFlow
Lite model)through the rknn-toolkit convert.
test.py: running script(include rknn model conversion script).
test_inference.py: running script(only 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

Page 11 of 32
classifications predicted by the model, wherein [156] indicates the dog's label, and
0.8837890625 indicates the probability of predicting the label. It can be seen that the
predicted result is the most likely for the dog. From the test picture (dog_224x224.jpg), we
can see that the prediction result is accurate.
Notice:
1.Yolov3 easy start demo refer to 《RK1808 AI_Compute_Stick_Easy
Start_Demo_Guide_EN.pdf》.
2.For more detailed usage and interface instructions of the RKNN-Toolkit, please refer to
《RKNN-Toolkit user guide _v1.1.0》.

Page 12 of 32
5 WEB configuration
RK1808 AI compute stick supports system configuration by web. How to access this
configuration page and its main functions will be described below.
5.1The Host Network Configuration
Windows 7/10 network configuration
1. Plug RK1808 AI compute stick。
2. Open the device manager,network adapter will display “Remote NDIS based Internet
Sharing Device”.
Notice: Some computer may have unrecognized devices, uninstall unrecognized devices,
and wait for the RNDIS driver to reinstall.
3. Click Windows network and Internet Settings,Click “Ethernet” -> “Change adapter
options”.

Page 13 of 32
4. Right click "Ethernet *" (remote NDIS compatible device), -> "attribute" -> "Internet
protocol version 4"->"attribute", and configure the IP address and mask as shown below,
thus completing the network configuration.

Page 14 of 32
5. Check the IP address.

Page 15 of 32
Linux network configuration (Take Ubuntu 18.04 as an example).
1. Before inserting RK1808 AI compute stick, open the terminal and enter the command:
ifconfig.
2. Then insert RK1808 AI compute stick and enter the command ifconfig again, you can
find an extra with red box in the picture.

Page 16 of 32
3. Click the system Settings, select the network, find the new device with the same Mac
address in step 2, and click the Settings icon in the upper right corner.
4. According to the figure below, select ipv4 ,select manually ,add a new IP --
192.168.180.1 255.255.255.0.Finally, Click apply to complete the network .

Page 17 of 32
5.2 WEB Login
1. After Network configuration is completed, you can input http://192.168.180.8 in the
browser. And then into RK1808 AI compute stick Login page.
If you forget the password, please click “Forget Password”.
Notice: It will not only reset the password, but also restore the RK1808 AI compute stick to factory
Settings. Please be careful

Page 18 of 32
2. Enter username and password to login (default username and password are both toybrick),
and then enter the Home page.
5.3 Introduction of Main Functions of WEB Pages
1. Home:Displays the main system information and configuration information for
RK1808 AI compute stick.

Page 19 of 32
2. Work Mode: The working mode is master or slave.

Page 20 of 32
3. USB Function: RK1808 AI compute stick Usbfunction(rndis/ntb/mass)。
4. Update: Update,Install RK1808 AI compute stick RPM resources.
5. Password: You can modify the login password here. After the modification, you need to
Table of contents