Difference between revisions of "Rock3/dev/npu-run-test"
(→Hardware supported) |
|||
Line 12: | Line 12: | ||
* ROCK 3 A | * ROCK 3 A | ||
− | * Radxa CM3 | + | * Radxa CM3 IO Board |
Revision as of 03:09, 24 November 2021
ROCK 3 > Development > NPU Run Test
Contents
Description
SoC RK3568 is equipped with 0.8TOPS NPU. This tutorial shows how to make the NPU run on ROCK 3 A, and provides an example and test results.
Hardware supported
- ROCK 3 A
- Radxa CM3 IO Board
Now follow me to make the NPU run. Here I use ROCK 3 A V1.3.
Setup steps
Step 1: Get system image
You can get system image from ROCK 3 A System images.
Here we are concerned about the kernel version. Make sure that kernel is at least 4.19.193-17-rockchip.
root@rock-3-a:/home/rock# uname -a Linux rock-3-a 4.19.193-17-rockchip-ga4e78ea509f7 #rockchip SMP Fri Nov 19 16:59:52 CST 2021 aarch64 GNU/Linux
If not, try to upgrade the kernel via the following commands.
Uncomment "deb http://apt.radxa.com/buster-testing/ buster main" in file /etc/apt/sources.list.d/apt-radxa-com.list. Here I use debian buster image. So its content is
deb http://apt.radxa.com/buster-stable/ buster main deb http://apt.radxa.com/buster-testing/ buster main
If you use ubuntu focal image, It should be like this
deb http://apt.radxa.com/focal-stable/ focal main deb http://apt.radxa.com/focal-testing/ focal main
After saving that file, now we install the latest kernel packages.
root@rock-3-a:/home/rock# apt update root@rock-3-a:/home/rock# apt install -y linux-4.19-rock-3-latest
Then reboot the device. Use command 'uname -a' to check the kernel verison again.
Step 2: Get RKNN2 SSD DEMO
Install 7z and curl tools.
root@rock-3-a:/home/rock# apt update root@rock-3-a:/home/rock# apt install -y p7zip-full curl
Get rknn2_ssd_demo_Linux.7z package, check the md5 of file. It should be 3855ac87205e5d11b9484441b983fcd7. And extract it.
root@rock-3-a:/home/rock# curl https://dl.radxa.com/rock3/npu/rknn2_ssd_demo_Linux.7z > rknn2_ssd_demo_Linux.7z root@rock-3-a:/home/rock# md5sum rknn2_ssd_demo_Linux.7z 3855ac87205e5d11b9484441b983fcd7 rknn2_ssd_demo_Linux.7z root@rock-3-a:/home/rock# 7z x rknn2_ssd_demo_Linux.7z
Thanks to zhongdechan, he provided the rknn2_ssd_demo_Linux.7z.
Step3: Run RKNN2 SSD DEMO
These are test commands and result.
root@rock-3-a:/home/rock# cd rknn2_ssd_demo_Linux root@rock-3-a:/home/rock/rknn2_ssd_demo_Linux# ./rknn_ssd_demo model/ssd_inception_v2.rknn model/road.bmp Loading model ... rknn_init ... I RKNN: set log level to 0 model input num: 1, output num: 2 input tensors: index=0 name=Preprocessor/sub:0 n_dims=4 dims=[1 300 300 3] n_elems=270000 size=270000 fmt=0 type=3 qnt_type=2 fl=0 zp=0 scale=0.007812 output tensors: index=0 name=concat:0 n_dims=4 dims=[1 1917 1 4] n_elems=7668 size=30672 fmt=0 type=0 qnt_type=2 fl=0 zp=53 scale=0.089455 index=1 name=concat_1:0 n_dims=4 dims=[1 1917 91 1] n_elems=174447 size=697788 fmt=0 type=0 qnt_type=2 fl=0 zp=53 scale=0.143593 rknn_run loadLabelName ssd - loadLabelName ./model/coco_labels_list.txt loadBoxPriors person @ (13 125 59 212) 0.984696 person @ (110 119 152 197) 0.969119 bicycle @ (171 165 278 234) 0.969119 person @ (206 113 256 216) 0.964519 car @ (146 133 216 170) 0.959264 person @ (49 133 58 156) 0.606060 person @ (83 134 92 158) 0.606060 person @ (96 135 106 162) 0.464163
You would also get the output image, out.jpg, under /home/rock/rknn2_ssd_demo_Linux directory.
Troubleshooting
Check ROCK 3 FAQs first, if it doesn't help, start a new post on the forum https://forum.radxa.com/c/rock3.