This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
products:sbc:vim4:npu:demos:yolov8n [2023/09/17 23:05] sravan [Get Source Code] |
products:sbc:vim4:npu:demos:yolov8n [2024/02/17 22:43] (current) louis |
||
---|---|---|---|
Line 12: | Line 12: | ||
``` | ``` | ||
- | Refer '' | + | Refer '' |
===== Convert Model ===== | ===== Convert Model ===== | ||
Line 18: | Line 18: | ||
==== Build virtual environment ==== | ==== Build virtual environment ==== | ||
- | Follow Docker official | + | Follow Docker official |
- | Get Docker. | + | Then fetch the prebuilt NPU Docker |
```shell | ```shell | ||
Line 42: | Line 42: | ||
After training model, modify '' | After training model, modify '' | ||
- | ```diff | + | ```diff head.py |
diff --git a/ | diff --git a/ | ||
index 0b02eb3..0a6e43a 100644 | index 0b02eb3..0a6e43a 100644 | ||
Line 66: | Line 66: | ||
+ dfl = self.cv2[i](x[i]).contiguous() | + dfl = self.cv2[i](x[i]).contiguous() | ||
+ cls = self.cv3[i](x[i]).contiguous() | + cls = self.cv3[i](x[i]).contiguous() | ||
- | + results.append(torch.cat([cls, | + | + results.append(torch.cat([cls, |
+ # results.append(torch.cat([cls, | + # results.append(torch.cat([cls, | ||
+ return tuple(results) | + return tuple(results) | ||
+ | + | ||
``` | ``` | ||
+ | |||
+ | <WRAP important> | ||
+ | If you pip-installed ultralytics package, you should modify in package. | ||
+ | </ | ||
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:// | ||
+ | |||
+ | {{: | ||
+ | </ | ||
Enter '' | Enter '' | ||
Line 169: | Line 179: | ||
<WRAP tip > | <WRAP tip > | ||
- | If your **yolov8n** model classes | + | If your **YOLOv8n** model classes |
</ | </ | ||