Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:edge2: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:edge2:npu:demos:yolov8n [2023/08/28 02:39]
louis ↷ Page moved from products:sbc:edge2:npu:demo2-yolov8n to products:sbc:edge2:npu:npu-demos:demo2-yolov8n
products:sbc:edge2:npu:demos:yolov8n [2024/02/17 22:04] (current)
louis
Line 1: Line 1:
-====== Demo2 Yolov8n ======+~~tag> YOLO NPU Edge2 RK3588~~ 
 + 
 +====== YOLOv8n OpenCV Edge2 Demo ====== 
 + 
 +{{indexmenu_n>2}}
  
 ===== Get Source Code ===== ===== Get Source Code =====
  
-Download yolov8 official codes. Refer README.md to train a yolov8n model.+Download YOLOv8 official code [[gh>ultralytics/ultralytics]]
  
 ```shell ```shell
 $ git clone https://github.com/ultralytics/ultralytics.git $ git clone https://github.com/ultralytics/ultralytics.git
 ``` ```
 +
 +Refer ''README.md'' to train a YOLOv8n model.
  
 ===== Convert Model ===== ===== Convert Model =====
Line 55: Line 61:
 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+```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 85: Line 91:
 ``` ```
  
-Create a python file written as follows to export onnx model.+<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.
  
 ```python export.py ```python export.py
Line 92: Line 102:
 results = model.export(format="onnx") results = model.export(format="onnx")
 ``` ```
 +
 +<WRAP important>
 +Use [[https://netron.app/ | Netron]] to check your model output like this. If not, please check your ''head.py''.
 +
 +{{:products:sbc:edge2:npu:demos:yolov8n-edge2-output.png?600|}}
 +</WRAP>
  
 Enter ''rknn-toolkit2/examples/onnx/yolov5'' and modify ''test.py'' as follows. Enter ''rknn-toolkit2/examples/onnx/yolov5'' and modify ''test.py'' as follows.
Line 139: Line 155:
 ==== Get source code ==== ==== Get source code ====
  
-Clone the source code form our [[gh>khadas/edge2-npu]].+Clone the source code from our [[gh>khadas/edge2-npu]].
  
 ```shell ```shell
Line 185: Line 201:
  
 <WRAP tip > <WRAP tip >
-If your yolov8n model classes is not the same as coco, please change ''data/coco_80_labels_list.txt'' and the ''OBJ_CLASS_NUM'' in ''include/postprocess.h''.+If your **YOLOv8n** model classes is not the same as **coco**, please change ''data/coco_80_labels_list.txt'' and the ''OBJ_CLASS_NUM'' in ''include/postprocess.h''.
 </WRAP> </WRAP>
  
Last modified: 2023/08/28 02:39 by louis