05-Linux_NPU_YOLOV5S_object_detection

1.What is NPU YOLOV5S?

YOLOV5S is an object detection algorithm in computer vision. It is part of the YOLO (You Only Look Once) series, developed by Joseph Redmon and Alexey Bochkovskiy, among others. The YOLO family of algorithms is known for its fast real-time object detection capabilities, capable of detecting and locating multiple objects in an image or video, including the object's category and location.

YOLOv5S is a variant in the YOLOv5 family. Different versions of YOLOv5 have different performance and model complexity. In general, "S" may stand for "Small" in YOLOv5S, which means it may be a lightweight model suitable for operating in resource-constrained environments, such as mobile devices or embedded systems. YOLOv5S may trade off between speed and accuracy to suit different application scenarios.

2. Analyze images and videos

RK Linux official rknn_yolov5_demo, source code support'RK3562 ',' RK3566 ',' RK3568 ',' RK3588 ', compile tools for image analysis and video analysis

source code path

(SDK)/external/rknpu2/examples/rknn_yolov5_demo

Source code reference and compilation

configuration environment

$ export TOOL_CHAIN=(SDK PATH)/prebuilts/gcc/linux-x86/aarch64/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/
$ export GCC_COMPILER=(SDK PATH)/prebuilts/gcc/linux-x86/aarch64/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu

SDK directory refers to, in fact, it should be replaced with its own actual directory

Compile the corresponding tool

$ cd external/rknpu2/examples/rknn_yolov5_demo/
$ ./build-linux_RK3562.sh

build-android_RK3562.sh build-android_RK3566_RK3568.sh build-android_RK3588.sh build-linux_RK3562.sh build-linux_RK3566_RK3568.sh build-linux_RK3588.sh

Select the corresponding script according to the actual IC for compilation

build tool path

Copy to the main board to run

tool use

rknn_yolov5_demo

Examples rknn_yolov5_demo use

person @/bus @is the corresponding identification information

rknn_yolov5_video_demo

Note that h264/h265 code streaming video is required

Examples rknn_yolov5_video_demo use

car @/bus @is the corresponding video identification information

3. Parse local video streams

Hardware environment

Testing environment: RK3568 Debian11

Currently RK3568, RK3588 can use this demo

Sample program testing

YOLOV5S object detection sample program, built into the Debian11 file system

Go to the sample program directory

Run the sample program

Get the sample program source code

  • Program source code built-in SDK directory

Compile the source code

  • Specify the cross-compilation toolchain path

Cross-compilation toolchain built-in SDK directory, the specific path can be modified by referring to the above command

  • Compile source code

After the compilation is successful, execute the program to generate the directory install/rknn_yolov5_demo_Linux/

  • Copy the program to the development board

Currently rknn_yolov5_demo_Linux /lib need to use the main board /rockchip-test/npu2/rknn_yolov5_demo_Linux/lib

Copy method can be used with U disk, network, etc

If you don't want to compile, you can get the executable program from the network disk directory 1-SDK Source software source code/demo/rknn_yolov5_demo_Linux .tar.gz

Run example:

program running

  • Program run command

RK356X can only run to 7 frames per second, and can optimize the program performance by itself

  • Program running interface

f8944680e7bd81aeec4cbddf2eab4b0

4. Parse the camera video stream

Hardware environment

Testing environment: RK3568 Debian11

Currently RK3568, RK3588 can use this demo

Sample program testing

YOLOV5S object detection sample program, built into the Debian11 file system

Go to the sample program directory

Run the sample program

If the running time is too long, the process will be terminated due to insufficient memory

Get the sample program source code

It is the same as parsing the local video stream using the demo, so the source code reference parsing the local video stream

Last updated