Converted with Pulsar2 version 7.0.
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.490
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.681
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.528
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.272
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.544
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.697
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.367
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.597
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.648
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.404
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.716
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.873
=== 正式 COCO mAP 结果 ===
原始输出: results/ax_val_5000/raw_outputs.npz
图数=5000 预测数=1499905
AP@[.5:.95]=0.4896 AP@.5=0.6810 AP@.75=0.5280
AP_small=0.2719 AP_medium=0.5441 AP_large=0.6973
python src/tool/evaluate_rfdetr.py --compare-metrics \
results/onnx_fp32_5000/metrics.json results/ax_val_5000/metrics.json \
--primary -metric 'AP@[0.5:0.95]'
量化精度正式对比
评测集: datasets/annotations_val2017/annotations/instances_val2017.json
图片数: 5000
metric | baseline | quantized | drop
-----------------|-----------|-----------|---------
AP@0.5 | 0.709629 | 0.680995 | 0.028634
AP@0.75 | 0.564776 | 0.528006 | 0.03677
AP@[0.5:0.95] | 0.522527 | 0.489605 | 0.032923
AP_large | 0.723467 | 0.697302 | 0.026165
AP_medium | 0.575634 | 0.544072 | 0.031562
AP_small | 0.312324 | 0.271881 | 0.040443
AR@1 | 0.382697 | 0.366594 | 0.016103
AR@10 | 0.621168 | 0.596892 | 0.024276
AR@100 | 0.672812 | 0.648423 | 0.024389
AR_large | 0.87384 | 0.872696 | 0.001144
AR_medium | 0.73998 | 0.715606 | 0.024374
AR_small | 0.447414 | 0.403977 | 0.043437
prediction_count | 1499568.0 | 1499905.0 | -337.0
1# 1. 下载模型
2git clone https://huggingface.co/AXERA-TECH/rf-detr-small
3cd rf-detr-small
4
5# 2. 从 Hugging Face 下载原始模型、导出并优化 ONNX
6python src/tool/export_rfdetr_small_onnx_hf.py
7
8# 3. 切分 ONNX
9python /b2_cut.py \
10 --input models/rfdetr_small_512_hf_sim.onnx \
11 --pulsar2-output models/rfdetr_small_512_b2_pulsar2.onnx \
12 --post-output models/rfdetr_small_512_b2_post.onnx
13
14# 4. 用 pulsar2 编译 rfdetr_small_512_b2_pulsar2.onnx
15# 配置:pulsar2_config.json
16pulsar2 build --target_hardware AX650 --input rfdetr_small_512_b2_pulsar2.onnx --output_dir output/ --config pulsar2_config.json
17
18# 5. 板端推理(脚本、模型、后处理 ONNX 与图片目录位于同级目录)
19python3 b2_infer_axmodel.py \
20 --axmodel rf-detr-small.axmodel --post-model rfdetr_small_512_b2_post.onnx \
21 --img-dir coco2017val_5000 --result-dir results/ax
22
23# 6. 开发机 COCO mAP 评测
24python rf_detr_small/evaluate_rfdetr.py \
25 --input results/b2/raw_outputs.npz \
26 --ann datasets/annotations_val2017/annotations/instances_val2017.json \
27 --result-dir results/onnx
28
29# 7. 对比 FP32 与量化后的 metrics.json
30python rf_detr_small/evaluate_rfdetr.py \
31 --compare-metrics \
32 results/onnx/metrics.json results/ax/metrics.json \
33 --primary-metric 'AP@[0.5:0.95]'