File size: 2,785 Bytes
e6fca26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
---
license: mit
language:
- en
pipeline_tag: object-detection
tags:
- Ultralytics
- YOLOv5
---

# YOLOv5

This version of YOLOv5 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 ax-samples](https://github.com/AXERA-TECH/ax-samples), which you can get the how to build the `ax_yolov5s`

- [The repo of axcl-samples](https://github.com/AXERA-TECH/axcl-samples), which you can get the how to build the `axcl_yolov5s`

- [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|cost|
|--|--|
|AX650| 6.32 ms |
|AX630C| TBD ms |

## How to use

Download all files from this repository to the device

```
root@ax650 ~/yolov5 # tree -L 2
.
β”œβ”€β”€ ax650
β”‚Β Β  └── yolov5s.axmodel
β”œβ”€β”€ ax_aarch64
β”‚Β Β  └── ax_yolov5s
β”œβ”€β”€ config.json
β”œβ”€β”€ ssd_horse.jpg
β”œβ”€β”€ README.md
β”œβ”€β”€ yolov5_config.json
β”œβ”€β”€ yolov5s-cut.onnx
β”œβ”€β”€ yolov5s.onnx
└── yolov5s_out.jpg

3 directories, 9 files
```

### Inference

Input image:
![](./ssd_horse.jpg)

#### Inference with AX650 Host, such as M4N-Dock(爱芯派Pro)

```
root@ax650 ~/yolov5 # ./ax_yolov5s -m yolov5s.axmodel -i ssd_horse.jpg
--------------------------------------
model file : yolov5s.axmodel
image file : ssd_horse.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:1.91 ms
--------------------------------------
Repeat 1 times, avg time 6.32 ms, max_time 6.32 ms, min_time 6.32 ms
--------------------------------------
detection num: 6
 0:  83%, [ 270,   13,  352,  228], person
17:  83%, [ 213,   60,  431,  363], horse
16:  79%, [ 143,  197,  195,  351], dog
 0:  74%, [ 431,  125,  450,  177], person
 7:  73%, [   0,  103,  136,  199], truck
 0:  47%, [ 402,  130,  411,  148], person
--------------------------------------
```

Output image:
![](./yolov5s_out.jpg)