YOLOv8 / README.md
lihongjie
add axcl
4b36b7d
---
license: mit
language:
- en
base_model:
- Ultralytics/YOLOv8
pipeline_tag: object-detection
tags:
- Ultralytics
- YOLOv8
---
# YOLOv8
This version of YOLOv8 has been converted to run on the Axera NPU using **w8a16** quantization.
This model has been optimized with the following LoRA:
Compatible with Pulsar2 version: 3.4
## Convert tools links:
For those who are interested in model conversion, you can try to export axmodel through
- [The repo of AXera Platform](https://github.com/AXERA-TECH/ax-samples), which you can get the detial of guide
- [Pulsar2 Link, How to Convert ONNX to axmodel](https://pulsar2-docs.readthedocs.io/en/latest/pulsar2/introduction.html)
## Support Platform
- AX650
- [M4N-Dock(爱芯派Pro)](https://wiki.sipeed.com/hardware/zh/maixIV/m4ndock/m4ndock.html)
- [M.2 Accelerator card](https://axcl-docs.readthedocs.io/zh-cn/latest/doc_guide_hardware.html)
- AX630C
- [爱芯派2](https://axera-pi-2-docs-cn.readthedocs.io/zh-cn/latest/index.html)
- [Module-LLM](https://docs.m5stack.com/zh_CN/module/Module-LLM)
- [LLM630 Compute Kit](https://docs.m5stack.com/zh_CN/core/LLM630%20Compute%20Kit)
|Chips|yolov8s|
|--|--|
|AX650| 3.6 ms |
|AX630C| TBD ms |
## How to use
Download all files from this repository to the device
```
root@ax650:~/YOLO11-Pose# tree
.
|-- ax650
| `-- yolov8s.axmodel
|-- ax_yolov8
|-- football.jpg
`-- yolov8_out.jpg
```
### Inference
Input image:
![](./football.jpg)
#### Inference with AX650 Host, such as M4N-Dock(爱芯派Pro)
```
root@ax650:~/samples/AXERA-TECH/YOLOv8# ./ax_yolov8 -m ax650/yolov8s.axmodel -i football.jpg
--------------------------------------
model file : ax650/yolov8s.axmodel
image file : football.jpg
img_h, img_w : 640 640
--------------------------------------
Engine creating handle is done.
Engine creating context is done.
Engine get io info is done.
Engine alloc io is done.
Engine push input is done.
--------------------------------------
post process cost time:3.96 ms
--------------------------------------
Repeat 1 times, avg time 3.64 ms, max_time 3.64 ms, min_time 3.64 ms
--------------------------------------
detection num: 7
0: 93%, [ 757, 215, 1131, 1156], person
0: 93%, [ 0, 354, 311, 1104], person
0: 93%, [1351, 342, 1627, 1032], person
0: 91%, [ 488, 478, 661, 998], person
32: 87%, [ 773, 889, 829, 939], sports ball
32: 77%, [1231, 876, 1280, 922], sports ball
0: 60%, [1840, 690, 1906, 809], person
--------------------------------------
```
Output image:
![](./yolov8_out.jpg)
#### Inference with M.2 Accelerator card
```
(base) axera@raspberrypi:~/lhj/YOLOv8 $ ./axcl_aarch64/axcl_yolov8 -m ax650/yolov8s.axmodel -i football.jpg
--------------------------------------
model file : ax650/yolov8s.axmodel
image file : football.jpg
img_h, img_w : 640 640
--------------------------------------
axclrtEngineCreateContextt is done.
axclrtEngineGetIOInfo is done.
grpid: 0
input size: 1
name: images
1 x 640 x 640 x 3
output size: 3
name: /model.22/Concat_output_0
1 x 80 x 80 x 144
name: /model.22/Concat_1_output_0
1 x 40 x 40 x 144
name: /model.22/Concat_2_output_0
1 x 20 x 20 x 144
==================================================
Engine push input is done.
--------------------------------------
post process cost time:0.98 ms
--------------------------------------
Repeat 1 times, avg time 3.75 ms, max_time 3.75 ms, min_time 3.75 ms
--------------------------------------
detection num: 7
0: 93%, [ 757, 215, 1131, 1156], person
0: 93%, [ 0, 354, 311, 1104], person
0: 93%, [1351, 342, 1627, 1032], person
0: 91%, [ 488, 478, 661, 998], person
32: 87%, [ 773, 889, 829, 939], sports ball
32: 77%, [1231, 876, 1280, 922], sports ball
0: 60%, [1840, 690, 1906, 809], person
--------------------------------------
```
Output image:
![](./yolov8_axcl_out.jpg)