In this document, we will introduce how to convert the ONNX model into a model that can be used on the C3V NPU. The first part introduces the working environment needed for model conversion. The second part introduces the steps of conversion.
Table of Contents |
---|
1. Environment
Vivante Acuity NN toolkit installation completed
Vivante_NN IDE installation completed
Download acuity_examples_c901149.tgz for model conversation
The VIP9000 NPU kernel driver Acuity , NN Toolkit, and ViviantelIDE NN IDE need to match the version:
VIP9000 NPU Kernel Driver | Acuity NN Toolkit | ViviantelIDENN IDE |
v6.4.13.8 | 6.18.1 | 5.7.2 |
v6.4.15.9 | 6.21.1 | 5.8.2 |
v6.4.18.5 | 6.30.7 | 5.10.1 |
1.1. Prepare
...
NN Toolkit Environment
Please refer to this document: Acuity toolkit environment Vivante ACUITY Toolkit
Export environment variable.
Code Block |
---|
export ACUITY_PATH=/home/users/data/share/c3v/acuity-toolkit-whl-6.18.1/bin |
1.2. Install the IDE
Please refer to this document: VivanteIDE Install
1.3. Uncompress
...
Examples
Code Block | ||
---|---|---|
| ||
tar xvf acuity_examples_c901149.tgz |
...
Code Block |
---|
cd Model source env.sh |
...
1.4. Demo Video
...
2. Transfer
2.1. Preparing
Create Model folder
Code Block |
---|
mkdir yolov8s cd yolov8s |
...
Code Block |
---|
cp ../yolov8s.onnx . cp ../input.jpg . |
Create a dataset.txt file, the content of dataset.txt is the input.jpg file name.
...
After completing the above steps, there will be the following files under yolov8s:
...
2.2. Implementing
Import
This command will import and translate an NN model to ACUITY formats. Execute the command in the console or terminal, and wait for it to complete.
...
After the command execution is completed, you will see the following four files added under the folder.
...
Quantize
Please modify the scale value(1/255) of yolov8s_inputmeta.yml.
...
After the command execution is completed, you will see the following two files added under the folder.
...
Inference
Inference the ACUITY NN model with the quantization data type.
Code Block |
---|
./pegasus_inference.sh yolov8s uint8 |
...
Export
Export the quantized application for device deployment. If you want to get the network binary, please modify the pegasus_export_ovx.sh for the nb file generating, and add both 3 lines marked in the red box.
...
Code Block |
---|
./pegasus_export_ovx.sh yolov8s uint8 |
...
We can get the nb NB file and a c file for NN graph setup information.
...
.
...
2.3. Demo Video
This video is the demo for yolov8s-detection int16 quantize.
...