This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
products:sbc:edge2:npu:demos:yolov8n [2023/08/22 06:09] louis |
products:sbc:edge2:npu:demos:yolov8n [2024/07/03 21:44] (current) louis |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ~~tag> YOLO NPU Edge2 RK3588~~ |
+ | |||
+ | ====== | ||
+ | |||
+ | {{indexmenu_n> | ||
===== Get Source Code ===== | ===== Get Source Code ===== | ||
- | Download | + | Download |
```shell | ```shell | ||
$ git clone https:// | $ git clone https:// | ||
``` | ``` | ||
+ | |||
+ | Refer '' | ||
===== Convert Model ===== | ===== Convert Model ===== | ||
Line 34: | Line 40: | ||
==== Get convert tool ==== | ==== Get convert tool ==== | ||
- | Download Tool from [[https:// | + | Download Tool from [[gh>rockchip-linux/ |
```shell | ```shell | ||
Line 51: | Line 57: | ||
``` | ``` | ||
- | ==== convert | + | ==== Convert |
- | After training model, modify ultralytics/ | + | After training model, modify |
- | ```shell | + | ```diff head.py |
diff --git a/ | diff --git a/ | ||
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. | ||
+ | </ | ||
- | ```shell | + | Create a python file written as follows to export **onnx** model. |
+ | |||
+ | ```python export.py | ||
from ultralytics import YOLO | from ultralytics import YOLO | ||
model = YOLO(" | model = YOLO(" | ||
Line 93: | Line 103: | ||
``` | ``` | ||
- | Enter rknn-toolkit2/examples/onnx/yolov5 and modify test.py as follows. | + | <WRAP important> |
+ | Use [[https://netron.app/ | Netron]] to check your model output like this. If not, please check your '' | ||
- | ```shell | + | {{: |
+ | </ | ||
+ | |||
+ | Enter '' | ||
+ | |||
+ | ```python test.py | ||
# Create RKNN object | # Create RKNN object | ||
rknn = RKNN(verbose=True) | rknn = RKNN(verbose=True) | ||
Line 106: | Line 122: | ||
# Load ONNX model | # Load ONNX model | ||
print(' | print(' | ||
- | ret = rknn.load_onnx(model=”./ | + | ret = rknn.load_onnx(model='./ |
if ret != 0: | if ret != 0: | ||
print(' | print(' | ||
Line 114: | Line 130: | ||
# Build model | # Build model | ||
print(' | print(' | ||
- | ret = rknn.build(do_quantization=True, | + | ret = rknn.build(do_quantization=True, |
if ret != 0: | if ret != 0: | ||
print(' | print(' | ||
Line 122: | Line 138: | ||
# Export RKNN model | # Export RKNN model | ||
print(' | print(' | ||
- | ret = rknn.export_rknn(“./ | + | ret = rknn.export_rknn('./ |
if ret != 0: | if ret != 0: | ||
print(' | print(' | ||
Line 129: | Line 145: | ||
``` | ``` | ||
- | Run test.py to generate rknn model. | + | Run '' |
```shell | ```shell | ||
Line 139: | Line 155: | ||
==== Get source code ==== | ==== Get source code ==== | ||
- | Clone the source code form our [[https:// | + | Clone the source code from our [[gh>khadas/ |
```shell | ```shell | ||
Line 156: | Line 172: | ||
=== Picture input demo === | === Picture input demo === | ||
- | Put yolov8n.rknn in edge2-npu/ | + | Put '' |
```shell | ```shell | ||
- | // compile | + | # Compile |
$ bash build.sh | $ bash build.sh | ||
- | // run | + | # Run |
$ cd install/ | $ cd install/ | ||
$ ./yolov8n data/ | $ ./yolov8n data/ | ||
Line 169: | Line 185: | ||
=== Camera input demo === | === Camera input demo === | ||
- | Put yolov8n.rknn in edge2-npu/ | + | Put '' |
```shell | ```shell | ||
- | // compile | + | # Compile |
$ bash build.sh | $ bash build.sh | ||
- | // run | + | # Run |
$ cd install/ | $ cd install/ | ||
$ ./ | $ ./ | ||
``` | ``` | ||
- | '' | + | <WRAP info > |
+ | '' | ||
+ | </ | ||
<WRAP tip > | <WRAP tip > | ||
- | If your yolov8n | + | If your **YOLOv8n** |
</ | </ | ||