How to Compile and Run NPU Test Programs Based on rknn_yolov5_demo on RK3568?

When developing NPU (Neural Processing Unit) related applications on RK3568, compiling and running test programs is a crucial step. This article will take rknn_yolov5_demo as an example and guide through each step in detail.

1. Preparation: Locate the Compilation Script

Open external/rknpu2/examples/rknn_yolov5_demo/build-linux_RK3566_RK3568.sh

Preparation: Locate the Compilation Script

2. Key Configuration: Modify the Cross-Compilation Toolchain Path

After opening the build-linux_RK3566_RK3568.sh file, modify the GCC_COMPILER to the path of the cross-compilation toolchain and save the file.

Key Configuration: Modify the Cross-Compilation Toolchain Path

3. Compile the rknn_yolov5_demo Program

In the terminal command window, navigate to the rknn_yolov5_demo folder:

cd external/rknpu2/examples/rknn_yolov5_demo/

Compile the rknn_yolov5_demo Program

Run the build-linux_RK3566_RK3568.sh script to compile the program:

./build-linux_RK3566_RK3568.sh

Compile the rknn_yolov5_demo Program

4. File Transfer: From Local to Development Board

Copy the contents of the install directory to the development board.

File Transfer: From Local to Development Board

5. Navigate to the Correct Directory: Preparing to Run the Program

Navigate to the corresponding directory on the development board.

Navigate to the Correct Directory: Preparing to Run the Program

6. Set the Library File Path

export LD_LIBRARY_PATH=./lib

Set the Library File Path

7. Run the Program to Identify Object Categories in the Image

The command format to run the program is: ./rknn_yolov5_demo

./rknn_yolov5_demo ./model/RK3566_RK3568/yolov5s-640-640.rknn ./model/bus.jpg

Run the Program to Identify Object Categories in the Image

8. View the Results

Finally, copy the resulting image generated on the OK3568-C development board to local computer and view it. This way, the program's object recognition results in the image can be visually observed, the accuracy of the recognition can be checked, and the performance of the NPU test program can be evaluated.

View the Results

View the Results

By following these detailed steps, the rknn_yolov5_demo NPU test program on RK3568 can be successfully compiled and run. It is hoped that this article will be helpful for the development work.




Dear friends, we have created an exclusive embedded technical exchange group on Facebook, where our experts share the latest technological trends and practical skills. Join us and grow together!