xujiashuai/timm-cv_nafnet_image-deblur_gopro
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

cv_nafnet_image-deblur_gopro - Ascend NPU 适配

1. 模型简介

NAFNet (Nonlinear Activation Free Network) 图像去模糊模型,在 GoPro 数据集上训练。NAFNet 通过移除非线性激活函数简化了网络结构,同时保持了优秀的去模糊性能。

  • 原始模型: damo/cv_nafnet_image-deblur_gopro
  • 框架: PyTorch
  • 任务: 图像去模糊 (Image Deblurring)

2. 昇腾 NPU 适配结果

指标值
Cosine Similarity0.999958
MaxAbsErr1.698051
Relative Error0.8650%
平均延迟28.17 ms
峰值显存0.4361 GB
参数量67,888,835
推理精度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):

Model: cv_nafnet_image-deblur_gopro (NAFNet)
Device: npu:0
Dtype: float32
Input shape: [1, 3, 256, 256]
------------------------------------------------------------

[CPU] Loading model...
[CPU] Parameters: 67,888,835
[CPU] Running inference...
[CPU] Output shape: [1, 3, 256, 256]

[NPU] Moving model to npu:0...
[NPU] Running inference...
[NPU] Output shape: [1, 3, 256, 256]

  Cosine Similarity: 0.999958
  MaxAbsErr:         1.698051
  Relative Error:    0.8650%

  Avg latency:  28.17 ms
  Peak HBM: 0.4361 GB

PASS: CPU vs NPU outputs match (cosine >= 0.99)

6. CPU vs NPU 精度对比

指标CPU (float32)NPU (float32)误差
Cosine Similarity基准0.999958< 0.01%
MaxAbsErr-1.698051-
Relative Error-0.8650%< 1% ✓
输出维度[1, 3, 256, 256][1, 3, 256, 256]一致
NaNFalseFalse一致

7. 模型结构

  • 架构: NAFNet (Nonlinear Activation Free Network)
  • 输入: 模糊图像 [1, 3, 256, 256]
  • 输出: 去模糊图像 [1, 3, 256, 256]
  • 训练数据: GoPro 数据集

8. 验证报告

详见 screenshots/verification.txt。

9. Agent Skill

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