Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:vim4:npu:demos:yolov8n

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
products:sbc:vim4:npu:demos:yolov8n [2024/01/04 04:51]
louis
products:sbc:vim4:npu:demos:yolov8n [2024/02/17 22:43] (current)
louis
Line 42: Line 42:
 After training model, modify ''ultralytics/ultralytics/nn/modules/head.py'' as follows. After training model, modify ''ultralytics/ultralytics/nn/modules/head.py'' as follows.
  
-```diff ultralytics/nn/modules/head.py.patch+```diff head.py
 diff --git a/ultralytics/nn/modules/head.py b/ultralytics/nn/modules/head.py diff --git a/ultralytics/nn/modules/head.py b/ultralytics/nn/modules/head.py
 index 0b02eb3..0a6e43a 100644 index 0b02eb3..0a6e43a 100644
Line 71: Line 71:
 + +
 ``` ```
 +
 +<WRAP important>
 +If you pip-installed ultralytics package, you should modify in package.
 +</WRAP>
  
 Create a python file written as follows to export ONNX model. Create a python file written as follows to export ONNX model.
Line 83: Line 87:
 $ python export.py $ python export.py
 ``` ```
 +
 +<WRAP important>
 +Use [[https://netron.app/ | Netron]] to check your model output like this. If not, please check your ''head.py''.
 +
 +{{:products:sbc:vim4:npu:demos:yolov8n-vim4-output.png?600|}}
 +</WRAP>
  
 Enter ''vim4_npu_sdk/demo'' and modify ''convert_adla.sh'' as follows. Enter ''vim4_npu_sdk/demo'' and modify ''convert_adla.sh'' as follows.
Line 103: Line 113:
         --input-shapes  "3,640,640"  \         --input-shapes  "3,640,640"  \
         --dtypes "float32" \         --dtypes "float32" \
-        --inference-input-type float32 \ +        --quantize-dtype int16 --outdir onnx_output  \
- --inference-output-type float32 \ +
-        --quantize-dtype int8 --outdir onnx_output  \+
         --channel-mean-value "0,0,0,255"  \         --channel-mean-value "0,0,0,255"  \
         --source-file dataset.txt  \         --source-file dataset.txt  \
-        --disable-per-channel False \ 
-        --iterations 500 \ 
         --batch-size 1 --target-platform PRODUCT_PID0XA003         --batch-size 1 --target-platform PRODUCT_PID0XA003
 ``` ```
- 
-<WRAP important > 
-Please prepare about 500 pictures for quantification. If the pictures size is smaller than model input size, please resize pictures to input size before quantification. 
-</WRAP> 
  
 Run ''convert_adla.sh'' to generate VIM4 model. The converted model is ''xxx.adla'' in ''onnx_output''. Run ''convert_adla.sh'' to generate VIM4 model. The converted model is ''xxx.adla'' in ''onnx_output''.
Line 132: Line 134:
 $ git clone https://github.com/khadas/vim4_npu_applications $ git clone https://github.com/khadas/vim4_npu_applications
 ``` ```
- 
-<WRAP important > 
-If your kernel version is 5.4 or earlier, please use tag ''ddk-1.7.5.5''. Tag ''ddk-2.3.6.7'' is for 5.15. 
-</WRAP> 
  
 ==== Install dependencies ==== ==== Install dependencies ====
Last modified: 2024/01/04 04:51 by louis