xujiashuai/timm-cv_tinynas_head-detection_damoyolo
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

cv_tinynas_head-detection_damoyolo - Ascend NPU 适配

1. 模型简介

TinyNAS DAMO-YOLO 是一个轻量级目标检测模型,专用于头部检测任务。采用 TinyNAS 搜索的骨干网络、GiraffeNeckV2 FPN 和 ZeroHead 架构。

  • 原始模型: iic/cv_tinynas_head-detection_damoyolo
  • 框架: PyTorch
  • 任务: Domain-Specific Object Detection (Head Detection)

2. 昇腾 NPU 适配结果

指标值
Cosine Similarity1.000000
MaxAbsErr0.198364
Relative Error0.0235%
平均延迟11.86 ms
峰值显存0.21 GB
参数量16,306,421
推理精度float32
设备Ascend 910B4

3. 环境要求

组件版本
CANN8.5.1
torch_npu2.9.0.post1
PyTorch2.9.0
Python3.11

4. 快速使用

# 设置环境
source setup_env.sh

# 运行推理 (CPU vs NPU 对比)
python3 inference.py --device npu:0

5. 推理输出证据

NPU 推理输出(float32, 640x640 输入):

模型: iic/cv_tinynas_head-detection_damoyolo
设备: npu:0
------------------------------------------------------------
[CPU] 加载模型...
[CPU] 推理中...
  CPU output shape: torch.Size([1, 8400, 5])
[NPU] 加载模型到 npu:0...
[NPU] 推理中...
  NPU output shape: torch.Size([1, 8400, 5])

  Cosine Similarity: 1.000000
  MaxAbsErr: 0.198364

✓ 推理完成

[Perf] 加载模型测延迟...
  平均延迟: 11.86 ms
  峰值显存: 0.21 GB

6. CPU vs NPU 精度对比

指标CPU (float32)NPU (float32)误差
Cosine Similarity基准1.000000< 0.001%
MaxAbsErr-0.198364-
Relative Error-0.0235%< 1% ✓
输出维度[1, 8400, 5][1, 8400, 5]一致
NaNFalseFalse一致

7. 模型结构

  • Backbone: TinyNAS (NAS-searched lightweight backbone)
  • Neck: GiraffeNeckV2 FPN
  • Head: ZeroHead (GFL-based detection head)
  • 输入: 640x640 RGB 图像
  • 输出: [1, 8400, 5] — 8400 个候选框 (x, y, w, h, score)

8. 验证报告

详见 screenshots/verification.txt。

9. Agent Skill

本适配由 Ascend NPU 适配 Agent Skill 自动完成。