...
NPU Kernel Driver | v6.4.15.9 | v6.4.18.5 |
Acuity Toolkit | 6.21.1 | 6.30.7 |
ViviantelIDE | 5.8.2 | 5.10.1 |
1. Model Conversation
Before the conversion, it is necessary to first set up the environment for model conversion. Please refer to the following document to prepare the environment:NN Model Conversion
...
We can get the nb file and a c file for NN graph setup information.
...
1.3. Demo Video
This video is the demo for yolov8s-detection int16 quantize.
...
2. Object Detection Program
...
For detailed function implementation, please refer to the following file:
View file | ||
---|---|---|
|
2.2. Program Compile
When compiling NN-related applications, SDK's headers and libraries must be included.
...
3. Example flow of the program build and run
Unzipped
View file | ||
---|---|---|
|
View file | ||
---|---|---|
|
...
Code Block |
---|
/mnt/yolov8s_uint8_nbg_unify # ./yolov8s-detection-uint8 ./network_binary.nb ./input.jpg Create Neural Network: 28ms31ms or 28375us31666us Verify... Verify Graph: 21ms18ms or 21116us18520us Start run graph [1] times... Run the 1 time: 5752.55ms67ms or 5754852667.24us43us vxProcessGraph execution time: Total 5852.05ms79ms or 5805352792.36us95us Average 5852.05ms79ms or 5805352792.36us95us obj: L: 0 P:0.9392, [(0294, 42264) - (200209, 599369)] obj: L: 0 P:0.9192, [(3090, 27944) - (180199, 361589)] obj: L: 0 P:0.5850, [(344349, 171169) - (170179, 301)] |
3.2. cross-compile in Linux
If you want to build the project in host Linux, please modify these contents of Makefile:
Code Block |
---|
BIN=yolov8s-detection-uint8
# 1.cross compile
NN_SDK_DIR=Path to NN SDK directory
TOOLCHAIN=Path to toolchain directory
CROSS_COMPILE=$(TOOLCHAIN)/aarch64-none-linux-gnu-
CC=$(CROSS_COMPILE)gcc
CXX=$(CROSS_COMPILE)g++ |
you need to set the right path of NN_SDK_DIR
and TOOLCHAIN
NN_SDK_DIR: The path to NPU SDK
TOOLCHAIN: The cross-compile toolchain path. which format may be like this:
Code Block |
---|
TOOLCHAIN=/pub/toolchain/crossgcc/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin |
then using make to compile the project.
Code Block |
---|
make |
Copy the application, network_binary.nb file and related libraries into C3V Linux and run:
The param1 is the nb file that converts from the acuity toolkit.
The param2 is the image that is for detection. Please prepare the image file which format is jpg and the pixel size is 640 * 640.
Code Block |
---|
./yolov8s-detection-uint8 ./network_binary.nb ./input299)] obj: L: 2 P:0.33, [(534, 294) - (74, 64)] obj: L: 0 P:0.26, [(539, 264) - (99, 349)] |
3.2. ImageWriter Tool
If you want to show the detection results in an image, we suggest using ImageWriter tools.
Please download
View file | ||
---|---|---|
|
Code Block |
---|
cd imageWriter
make -j |
Then you can run the imageWriter application directly on c3v:
Param1 is the image which is the same as yolov8s-detection-uint8 param2. The yolov8s-detection-uint8 is the application that is built in step 3.1. build in c3v.
Param2 is the file detect_results.raw which was generated after the program yolov8s-detection-uint8 runs.
Param3 is the output name, which format is jpg.
Code Block |
---|
./imageWriter ./input.jpg ./detect_results.raw ./output.jpg |
The result is like this:
...
3.3. Demo Video
...