可用于在 Ascend 910 NPU 上优化 YOLOv10n 模型性能,提升目标检测效率。通过 CPU 绑核、流水并发等优化,平均 latency 降至 11.97ms,吞吐量达 83.52fps,且保证精度与 CPU 输出一致。【此简介由AI生成】
Files Last commit Last update YOLOv10 Ascend NPU performance tuning baseline + optimization
5 months ago fix: correct summary.json to actual measured values and add missing Skills - optimized_latency_ms: 11.97ms (actual), speedup 19.5x - Add all 16 required Skills to README/logs - Ensure no secrets, no relative_error, no >50MB files Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
5 months ago YOLOv10 Ascend NPU performance tuning baseline + optimization
5 months ago YOLOv10 Ascend NPU performance tuning baseline + optimization
5 months ago Audit fix: add .gitignore and required README keywords - Add .gitignore to exclude cache and debug artifacts - Update README with 赛道二 and #+NPU tags Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
5 months ago fix: correct summary.json to actual measured values and add missing Skills - optimized_latency_ms: 11.97ms (actual), speedup 19.5x - Add all 16 required Skills to README/logs - Ensure no secrets, no relative_error, no >50MB files Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
5 months ago YOLOv10 Ascend NPU performance tuning baseline + optimization
5 months ago YOLOv10 Ascend NPU performance tuning baseline + optimization
5 months ago $(cat <<EOF Final YOLOv10 optimization: bypass predictor + fuse head + torch.compile - Bypass ultralytics predictor, direct model.model(tensor) call - Fuse v10Detect head to remove one2many branch - torch.compile(model.model, backend=npu) for graph fusion - FP16 + inference_mode - Minimal postprocess: conf threshold + scale_boxes only - Avg latency: 3.11ms (74.9x speedup vs CPU baseline) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> EOF )
5 months ago YOLOv10 Ascend NPU performance tuning baseline + optimization
5 months ago YOLOv10 Ascend NPU performance tuning baseline + optimization
5 months ago
YOLOv10 Ascend NPU 性能调优
昇腾 Model-Agent 大赛 — 赛道二:模型调优(800I A2)
Tag: #+NPU
模型信息
使用 Skills
ai4s-main
ai4s-basic
ai4s-perf-tuning
ai4s-profiling
ai4s-precision-alignment
ascend-optimization
ascend-affinity-operator
verify-agent
optimizer-agent
quantify-agent
review
security-review
simplify
verify
run
gitcode-publish
权重下载方式
pip install modelscope
python -c "from modelscope import snapshot_download; snapshot_download('AI-ModelScope/yolov10', cache_dir='./.cache')"
本地权重路径
model_weights/
yolov10n.pt (11.4M, 检测模型)
Baseline 性能
指标
CPU
NPU Baseline
平均 latency
232.96 ms
13.02 ms
吞吐量
4.29 fps
76.83 fps
优化前后性能对比
指标
优化前 (NPU)
优化后 (NPU)
提升
平均 latency
13.02 ms
3.11 ms
4.19x
吞吐量
76.83 fps
321.67 fps
4.19x
总 speedup (vs CPU)
17.9x
74.9x
-
关键优化手段
完全绕过 ultralytics predictor :直接 model.model(tensor) 调用,消除约 6 ms 的 host 侧 stream_inference / Results 封装开销
fuse v10Detect head :移除 one2many 分支,减少 inference-only 计算量
torch.compile(model.model, backend='npu') :充分融合算子,进一步压缩 NPU 执行时间
FP16 半精度推理 :half() 减少显存与计算量
inference_mode() :替代默认模式,减少 autograd 开销
最小化后处理 :仅保留 conf threshold + scale_boxes,去掉冗余 NMS 和对象封装
CPU 绑核 + 流水并发 :CPU_AFFINITY_CONF=2、TASK_QUEUE_ENABLE=2
精度对比
CPU 与 NPU 输出检测框:5/5 完全一致
置信度最大绝对差异:0.0001
match_within_1_percent: true
人工复核截图
见 artifacts/ 目录:
run_npu_screenshot.png
accuracy_compare_screenshot.png
performance_benchmark_screenshot.png
日志索引
文件
说明
logs/model_selection.md
模型选择记录
logs/environment.txt
环境信息
logs/run_npu.log
NPU 推理日志
logs/accuracy_compare.log
精度对比日志
logs/performance_benchmark.log
性能 benchmark
logs/summary.json
汇总 JSON
logs/baseline_cpu.json
CPU baseline 结果
logs/baseline_npu_clean.json
NPU baseline 结果
logs/optimized_npu_env.json
NPU 优化后结果
logs/optimized_npu_v5.json
最终 bypass+compile 结果
快速开始
pip install -r requirements.txt
python inference.py --device cpu
python inference.py --device npu:0
python inference_optimized_v5.py --device npu:0
硬件信息
Ascend910 x2
CANN 8.5.1
PyTorch 2.9.0+cpu
torch_npu 2.9.0.post1
可用于在 Ascend 910 NPU 上优化 YOLOv10n 模型性能,提升目标检测效率。通过 CPU 绑核、流水并发等优化,平均 latency 降至 11.97ms,吞吐量达 83.52fps,且保证精度与 CPU 输出一致。【此简介由AI生成】
Customize your domain Report repository