YOLO11
This version of YOLO11 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, which you can get the how to build the
ax_yolo11The repo of axcl-samples, which you can get the how to build the
axcl_yolo11
Support Platform
- AX650
- AX630C
| Chips | cost |
|---|---|
| AX650 | 25 ms |
| AX630C | TBD ms |
Performance Statistics
Tip: 表中 ONNX (mAP50) 数据来源于官方。经 coco-val2017 实测,实际运行的 ONNX 模型精度较该数值略低约 1.3%,因此 AXModel 的实际量化损失(精度跌幅)其实更小。
| Model | ONNX (mAP50) | AXModel (mAP50) | FPS | CMM(MB) | Latency(ms) |
|---|---|---|---|---|---|
| yolo11s | 0.638 | 0.615 | 314 | 10.00 | 3.181 |
| yolo11x | 0.716 | 0.696 | 41 | 71.40 | 24.650 |
How to use
Download all files from this repository to the device
(axcl) axera@raspberrypi:~/samples/AXERA-TECH/YOLO11 $ tree -L 2
.
├── ax620e
│ └── yolo11s.axmodel.onnx
├── ax650
│ ├── yolo11s.axmodel
│ └── yolo11x.axmodel
├── ax_aarch64
│ └── ax_yolo11
├── axcl_aarch64
│ └── axcl_yolo11
├── axcl_x86_64
│ └── axcl_yolo11
├── config.json
├── cut-onnx.py
├── football.jpg
├── README.md
├── ssd_horse.jpg
├── yolo11_config.json
├── yolo11_out.jpg
├── yolo11s-cut.onnx
└── yolo11-test.py
6 directories, 15 files
Inference
Input image:
Inference with AX650 Host, such as M4N-Dock(爱芯派Pro)
root@ax650:~/samples/AXERA-TECH/YOLO11# ./ax_aarch64/ax_yolo11 -m ax650/yolo11x.axmodel -i football.jpg
--------------------------------------
model file : ax650/yolo11x.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:4.20 ms
--------------------------------------
Repeat 1 times, avg time 24.56 ms, max_time 24.56 ms, min_time 24.56 ms
--------------------------------------
detection num: 9
0: 94%, [ 757, 220, 1127, 1154], person
0: 94%, [ 0, 357, 314, 1112], person
0: 93%, [1353, 339, 1629, 1037], person
0: 91%, [ 494, 476, 659, 1001], person
32: 86%, [1231, 877, 1281, 922], sports ball
32: 73%, [ 774, 887, 828, 938], sports ball
32: 66%, [1012, 882, 1051, 927], sports ball
0: 54%, [ 0, 543, 83, 1000], person
0: 46%, [1837, 696, 1877, 814], person
--------------------------------------
Output image:
Inference with M.2 Accelerator card
(axcl) axera@raspberrypi:~/samples/AXERA-TECH/YOLO11 $ ./axcl_aarch64/axcl_yolo11 -m ax650/yolo11x.axmodel -i football.jpg
--------------------------------------
model file : ax650/yolo11x.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.23/Concat_output_0
1 x 80 x 80 x 144
name: /model.23/Concat_1_output_0
1 x 40 x 40 x 144
name: /model.23/Concat_2_output_0
1 x 20 x 20 x 144
==================================================
Engine push input is done.
--------------------------------------
post process cost time:1.38 ms
--------------------------------------
Repeat 1 times, avg time 24.73 ms, max_time 24.73 ms, min_time 24.73 ms
--------------------------------------
detection num: 9
0: 94%, [ 757, 220, 1127, 1154], person
0: 94%, [ 0, 357, 314, 1112], person
0: 93%, [1353, 339, 1629, 1037], person
0: 91%, [ 494, 476, 659, 1001], person
32: 86%, [1231, 877, 1281, 922], sports ball
32: 73%, [ 774, 887, 828, 938], sports ball
32: 66%, [1012, 882, 1051, 927], sports ball
0: 54%, [ 0, 543, 83, 1000], person
0: 46%, [1837, 696, 1877, 814], person
--------------------------------------
COCO val2017 evaluation
The standalone scripts under src/ support single-image checks and complete COCO detection evaluation. The ONNX model uses FP32 NCHW input; the compiled axmodel uses U8 NHWC input. Both contracts require 640x640 input and three detection heads at strides 8, 16 and 32, with 144 channels (64 DFL + 80 classes). Both scripts use letterbox with right/bottom padding; the older single-image example uses direct resize, so its detections are not directly comparable.
Run FP32 ONNX inference on the host:
../../../venv/bin/python src/infer/yolo11_infer_onnx.py \
--model yolo11s-cut.onnx --dataset ../../../datasets/val2017 \
--output-dir results/onnx-val --full-output
Run axmodel inference on the target board:
python3 src/infer/yolo11_infer_axmodel.py \
--axmodel ax650/yolo11s.axmodel --dataset val2017 \
--output-dir results/ax-val --full-output
--full-output writes predictions.json, image_ids.json and timing JSON. It does not save dense output NPZ files. Without --full-output, dataset mode is fast mode and only times image read, preprocessing and model inference. Use --warmup N to exclude warmup runs from timing. Single-image mode writes detection.jpg; --debug, --dump-npz and --ref-npz are available only in that mode.
Evaluate with pycocotools:
../../../venv/bin/python src/tool/evaluate_yolo11.py \
--predictions results/onnx-val/predictions.json \
--annotations ../../../datasets/annotations_val2017/annotations/instances_val2017.json \
--output-dir results/onnx-metrics
../../../venv/bin/python src/tool/evaluate_yolo11.py \
--predictions results/onnx-val/predictions.json \
--ax-predictions results/ax-val/predictions.json \
--annotations ../../../datasets/annotations_val2017/annotations/instances_val2017.json \
--output-dir results/compare
The evaluator writes backend prediction copies and metrics.json with COCO bbox AP/AR metrics. Use --subset only for an intentional partial-dataset test.
Complete ONNX model evaluation
For .pt checkpoints, export the complete FP32 ONNX model without cutting its
heads. Each size has its own directory under results/onnx/<size>/: the model
file is yolo11<size>.onnx, performance/host_timing.json holds the fast-mode
baseline, full-output/ holds predictions and full-path timing, and metrics/
holds COCO bbox AP/AR. The existing yolo11s-cut.onnx results remain separate.
The complete ONNX native [1,84,8400] output contains decoded xywh boxes and
80 class scores. --full-output applies class-wise NMS, maps COCO categories,
and writes predictions.json plus image_ids.json; the evaluator calculates AP.
Fast mode skips this postprocessing and cannot produce accuracy results.
../../../venv/bin/python src/tool/export_yolo11_onnx.py \
--weights yolo11s.pt --output-dir results/onnx/s
../../../venv/bin/python src/tool/export_yolo11_onnx.py \
--weights yolo11x.pt --output-dir results/onnx/x
../../../venv/bin/python src/infer/yolo11_infer_onnx.py \
--model results/onnx/s/yolo11s.onnx --dataset ../../../datasets/val2017 \
--output-dir results/onnx/s/performance
../../../venv/bin/python src/infer/yolo11_infer_onnx.py \
--model results/onnx/x/yolo11x.onnx --dataset ../../../datasets/val2017 \
--output-dir results/onnx/x/performance
../../../venv/bin/python src/infer/yolo11_infer_onnx.py \
--model results/onnx/s/yolo11s.onnx --dataset ../../../datasets/val2017 \
--output-dir results/onnx/s/full-output --full-output
../../../venv/bin/python src/tool/evaluate_yolo11.py \
--predictions results/onnx/s/full-output/predictions.json \
--annotations ../../../datasets/annotations_val2017/annotations/instances_val2017.json \
--output-dir results/onnx/s/metrics
../../../venv/bin/python src/infer/yolo11_infer_onnx.py \
--model results/onnx/x/yolo11x.onnx --dataset ../../../datasets/val2017 \
--output-dir results/onnx/x/full-output --full-output
../../../venv/bin/python src/tool/evaluate_yolo11.py \
--predictions results/onnx/x/full-output/predictions.json \
--annotations ../../../datasets/annotations_val2017/annotations/instances_val2017.json \
--output-dir results/onnx/x/metrics
Both runs processed all 5000 val2017 images on ONNX Runtime's
CPUExecutionProvider with 640x640 RGB input and three warmup runs. Model
loading and warmup are excluded. The existing fast-mode performance-only
measurements below have a different timing scope from the full evaluation:
| Size | Complete ONNX model | 5000-image timing | Inference mean | End-to-end mean | End-to-end FPS |
|---|---|---|---|---|---|
| s | yolo11s.onnx | host_timing.json | 62.509 ms | 70.677 ms | 14.149 |
| x | yolo11x.onnx | host_timing.json | 196.503 ms | 203.363 ms | 4.917 |
smoke-performance/ under each size contains an earlier two-image interface
check; use performance/host_timing.json for the full-dataset results.