Commit
·
e6fca26
1
Parent(s):
08ae328
upload yolov5 and ax650 example
Browse files- README.md +102 -3
- ax650/yolov5s.axmodel +3 -0
- ax_aarch64/ax_yolov5s +3 -0
- config.json +0 -0
- ssd_horse.jpg +3 -0
- yolov5_config.json +42 -0
- yolov5s-cut.onnx +3 -0
- yolov5s.onnx +3 -0
- yolov5s_out.jpg +3 -0
README.md
CHANGED
|
@@ -1,3 +1,102 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
pipeline_tag: object-detection
|
| 6 |
+
tags:
|
| 7 |
+
- Ultralytics
|
| 8 |
+
- YOLOv5
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# YOLOv5
|
| 12 |
+
|
| 13 |
+
This version of YOLOv5 has been converted to run on the Axera NPU using **w8a16** quantization.
|
| 14 |
+
|
| 15 |
+
This model has been optimized with the following LoRA:
|
| 16 |
+
|
| 17 |
+
Compatible with Pulsar2 version: 3.4
|
| 18 |
+
|
| 19 |
+
## Convert tools links:
|
| 20 |
+
|
| 21 |
+
For those who are interested in model conversion, you can try to export axmodel through
|
| 22 |
+
|
| 23 |
+
- [The repo of ax-samples](https://github.com/AXERA-TECH/ax-samples), which you can get the how to build the `ax_yolov5s`
|
| 24 |
+
|
| 25 |
+
- [The repo of axcl-samples](https://github.com/AXERA-TECH/axcl-samples), which you can get the how to build the `axcl_yolov5s`
|
| 26 |
+
|
| 27 |
+
- [Pulsar2 Link, How to Convert ONNX to axmodel](https://pulsar2-docs.readthedocs.io/en/latest/pulsar2/introduction.html)
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
## Support Platform
|
| 31 |
+
|
| 32 |
+
- AX650
|
| 33 |
+
- [M4N-Dock(爱芯派Pro)](https://wiki.sipeed.com/hardware/zh/maixIV/m4ndock/m4ndock.html)
|
| 34 |
+
- [M.2 Accelerator card](https://axcl-docs.readthedocs.io/zh-cn/latest/doc_guide_hardware.html)
|
| 35 |
+
- AX630C
|
| 36 |
+
- [爱芯派2](https://axera-pi-2-docs-cn.readthedocs.io/zh-cn/latest/index.html)
|
| 37 |
+
- [Module-LLM](https://docs.m5stack.com/zh_CN/module/Module-LLM)
|
| 38 |
+
- [LLM630 Compute Kit](https://docs.m5stack.com/zh_CN/core/LLM630%20Compute%20Kit)
|
| 39 |
+
|
| 40 |
+
|Chips|cost|
|
| 41 |
+
|--|--|
|
| 42 |
+
|AX650| 6.32 ms |
|
| 43 |
+
|AX630C| TBD ms |
|
| 44 |
+
|
| 45 |
+
## How to use
|
| 46 |
+
|
| 47 |
+
Download all files from this repository to the device
|
| 48 |
+
|
| 49 |
+
```
|
| 50 |
+
root@ax650 ~/yolov5 # tree -L 2
|
| 51 |
+
.
|
| 52 |
+
├── ax650
|
| 53 |
+
│ └── yolov5s.axmodel
|
| 54 |
+
├── ax_aarch64
|
| 55 |
+
│ └── ax_yolov5s
|
| 56 |
+
├── config.json
|
| 57 |
+
├── ssd_horse.jpg
|
| 58 |
+
├── README.md
|
| 59 |
+
├── yolov5_config.json
|
| 60 |
+
├── yolov5s-cut.onnx
|
| 61 |
+
├── yolov5s.onnx
|
| 62 |
+
└── yolov5s_out.jpg
|
| 63 |
+
|
| 64 |
+
3 directories, 9 files
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
### Inference
|
| 68 |
+
|
| 69 |
+
Input image:
|
| 70 |
+

|
| 71 |
+
|
| 72 |
+
#### Inference with AX650 Host, such as M4N-Dock(爱芯派Pro)
|
| 73 |
+
|
| 74 |
+
```
|
| 75 |
+
root@ax650 ~/yolov5 # ./ax_yolov5s -m yolov5s.axmodel -i ssd_horse.jpg
|
| 76 |
+
--------------------------------------
|
| 77 |
+
model file : yolov5s.axmodel
|
| 78 |
+
image file : ssd_horse.jpg
|
| 79 |
+
img_h, img_w : 640 640
|
| 80 |
+
--------------------------------------
|
| 81 |
+
Engine creating handle is done.
|
| 82 |
+
Engine creating context is done.
|
| 83 |
+
Engine get io info is done.
|
| 84 |
+
Engine alloc io is done.
|
| 85 |
+
Engine push input is done.
|
| 86 |
+
--------------------------------------
|
| 87 |
+
post process cost time:1.91 ms
|
| 88 |
+
--------------------------------------
|
| 89 |
+
Repeat 1 times, avg time 6.32 ms, max_time 6.32 ms, min_time 6.32 ms
|
| 90 |
+
--------------------------------------
|
| 91 |
+
detection num: 6
|
| 92 |
+
0: 83%, [ 270, 13, 352, 228], person
|
| 93 |
+
17: 83%, [ 213, 60, 431, 363], horse
|
| 94 |
+
16: 79%, [ 143, 197, 195, 351], dog
|
| 95 |
+
0: 74%, [ 431, 125, 450, 177], person
|
| 96 |
+
7: 73%, [ 0, 103, 136, 199], truck
|
| 97 |
+
0: 47%, [ 402, 130, 411, 148], person
|
| 98 |
+
--------------------------------------
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
Output image:
|
| 102 |
+

|
ax650/yolov5s.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9ca3c59f7df28557c920c28c10a0aebe21a645ca9de9e8f73913393fd1939edb
|
| 3 |
+
size 7693527
|
ax_aarch64/ax_yolov5s
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:81ca2c044974609d04093deecdecc541b5a738a3a72af3766914a46b94a19871
|
| 3 |
+
size 5474824
|
config.json
ADDED
|
File without changes
|
ssd_horse.jpg
ADDED
|
Git LFS Details
|
yolov5_config.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "ONNX",
|
| 3 |
+
"npu_mode": "NPU1",
|
| 4 |
+
"quant": {
|
| 5 |
+
"input_configs": [
|
| 6 |
+
{
|
| 7 |
+
"tensor_name": "images",
|
| 8 |
+
"calibration_dataset": "coco_1000.tar",
|
| 9 |
+
"calibration_size": 32,
|
| 10 |
+
"calibration_mean": [0, 0, 0],
|
| 11 |
+
"calibration_std": [255.0, 255.0, 255.0]
|
| 12 |
+
}
|
| 13 |
+
],
|
| 14 |
+
"calibration_method": "MinMax",
|
| 15 |
+
"precision_analysis": true,
|
| 16 |
+
"precision_analysis_method":"EndToEnd"
|
| 17 |
+
},
|
| 18 |
+
"input_processors": [
|
| 19 |
+
{
|
| 20 |
+
"tensor_name": "images",
|
| 21 |
+
"tensor_format": "RGB",
|
| 22 |
+
"src_format": "BGR",
|
| 23 |
+
"src_dtype": "U8",
|
| 24 |
+
"src_layout": "NHWC"
|
| 25 |
+
}
|
| 26 |
+
],
|
| 27 |
+
"output_processors": [
|
| 28 |
+
{
|
| 29 |
+
"tensor_name": "/model.24/m.0/Conv_output_0",
|
| 30 |
+
"dst_perm": [0, 2, 3, 1]
|
| 31 |
+
}, {
|
| 32 |
+
"tensor_name": "/model.24/m.1/Conv_output_0",
|
| 33 |
+
"dst_perm": [0, 2, 3, 1]
|
| 34 |
+
}, {
|
| 35 |
+
"tensor_name": "/model.24/m.2/Conv_output_0",
|
| 36 |
+
"dst_perm": [0, 2, 3, 1]
|
| 37 |
+
}
|
| 38 |
+
],
|
| 39 |
+
"compiler": {
|
| 40 |
+
"check": 2
|
| 41 |
+
}
|
| 42 |
+
}
|
yolov5s-cut.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:04351119184b381543e97d439b17bbc3b5543f693475d0bb8635cac9199fa3cc
|
| 3 |
+
size 28953396
|
yolov5s.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:037c6e472a5ed79e93ad773ed653f1a440722ad86e0836d04f2908119fb22757
|
| 3 |
+
size 29380016
|
yolov5s_out.jpg
ADDED
|
Git LFS Details
|