xref: /OK3568_Linux_fs/external/rknpu2/examples/rknn_api_demo/README.md (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunThe following <TARGET_PLATFORM> represents RK356X or RK3588.
2*4882a593Smuzhiyun# Aarch64 Linux Demo
3*4882a593Smuzhiyun## Build
4*4882a593Smuzhiyun
5*4882a593Smuzhiyunmodify `GCC_COMPILER` on `build-linux_<TARGET_PLATFORM>.sh` for target platform, then execute
6*4882a593Smuzhiyun
7*4882a593Smuzhiyun```
8*4882a593Smuzhiyun./build-linux_<TARGET_PLATFORM>.sh
9*4882a593Smuzhiyun```
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun## Install
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunCopy install/rknn_api_demo_Linux and ../rknn_mobilenet_demo/model/ to the devices.
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun- If you use rockchip's evb board, you can use the following way:
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunConnect device and push the program and rknn model to `/userdata`
18*4882a593Smuzhiyun
19*4882a593Smuzhiyun```
20*4882a593Smuzhiyunadb push install/rknn_api_demo_Linux /userdata/
21*4882a593Smuzhiyunadb push ../rknn_mobilenet_demo/model/ /userdata/rknn_api_demo_Linux
22*4882a593Smuzhiyun```
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun- If your board has sshd service, you can use scp or other methods to copy the program and rknn model to the board.
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun## Run
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun```
29*4882a593Smuzhiyunadb shell
30*4882a593Smuzhiyuncd /userdata/rknn_api_demo_Linux/
31*4882a593Smuzhiyun```
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun```
34*4882a593Smuzhiyunexport LD_LIBRARY_PATH=./lib
35*4882a593Smuzhiyun./rknn_create_mem_demo model/<TARGET_PLATFORM>/mobilenet_v1.rknn model/dog_224x224.jpg
36*4882a593Smuzhiyun./rknn_create_mem_with_rga_demo model/<TARGET_PLATFORM>/mobilenet_v1.rknn model/dog_224x224.jpg
37*4882a593Smuzhiyun```
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun# Android Demo
40*4882a593Smuzhiyun## Build
41*4882a593Smuzhiyun
42*4882a593Smuzhiyunmodify `ANDROID_NDK_PATH` on `build-android_<TARGET_PLATFORM>.sh` for target platform, then execute
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun```
45*4882a593Smuzhiyun./build-android_<TARGET_PLATFORM>.sh
46*4882a593Smuzhiyun```
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun## Install
49*4882a593Smuzhiyun
50*4882a593Smuzhiyunconnect device and push build output into `/data`
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun```
53*4882a593Smuzhiyunadb push install/rknn_api_demo_Android /data/
54*4882a593Smuzhiyunadb push ../rknn_mobilenet_demo/model/ /userdata/rknn_api_demo_Android
55*4882a593Smuzhiyun```
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun## Run
58*4882a593Smuzhiyun
59*4882a593Smuzhiyun```
60*4882a593Smuzhiyunadb shell
61*4882a593Smuzhiyuncd /data/rknn_api_demo_Android/
62*4882a593Smuzhiyun```
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun```
65*4882a593Smuzhiyunexport LD_LIBRARY_PATH=./lib
66*4882a593Smuzhiyun./rknn_create_mem_demo model/<TARGET_PLATFORM>/mobilenet_v1.rknn model/dog_224x224.jpg
67*4882a593Smuzhiyun./rknn_create_mem_with_rga_demo model/<TARGET_PLATFORM>/mobilenet_v1.rknn model/dog_224x224.jpg
68*4882a593Smuzhiyun./rknn_with_mmz_demo model/<TARGET_PLATFORM>/mobilenet_v1.rknn model/dog_224x224.jpg
69*4882a593Smuzhiyun./rknn_set_internal_mem_from_fd_demo model/<TARGET_PLATFORM>/mobilenet_v1.rknn model/dog_224x224.jpg
70*4882a593Smuzhiyun./rknn_set_internal_mem_from_phy_demo model/<TARGET_PLATFORM>/mobilenet_v1.rknn model/dog_224x224.jpg
71*4882a593Smuzhiyun```
72*4882a593Smuzhiyun
73*4882a593Smuzhiyun# Note
74*4882a593Smuzhiyun - You may need to update libmpimmz.so and its header file of this project according to the implementation of MMZ in the system.
75*4882a593Smuzhiyun - You may need to update librga.so and its header file of this project according to the implementation of RGA in the system. https://github.com/airockchip/librga.
76*4882a593Smuzhiyun    For rk3562, the librga version need to be 1.9.1 or higher.
77*4882a593Smuzhiyun - You may need to use r19c or older version of ndk for compiling with MMZ related demo.