XiaYuanOwO/ascend-efficientnet-b0-ra-in1k-model
模型介绍文件和版本Pull Requests讨论分析
下载使用量0

EfficientNet-B0(efficientnet_b0.ra_in1k)- 昇腾NPU适配

#+NPU

模型说明

  • 模型名称:带随机增强的EfficientNet-B0(efficientnet_b0.ra_in1k)
  • 网络结构:EfficientNet-B0
  • 参数量:约530万
  • 任务:图像分类(1000类,ImageNet-1k)
  • 预训练:是(在ImageNet-1k上预训练)

原始模型

  • 来源:timm库
  • 模型网址:https://timm.dev/models.efficientnet_b0.html
  • 权重位置:首次使用时下载至~/.cache/timm/

硬件

  • 目标硬件:昇腾NPU(Atlas 800 A2/A3)
  • 设备:npu:0

软件环境

- Python 3.11+
- PyTorch 2.1.0+
- timm (latest)
- torch_npu (latest)
- torchvision (latest)
- CANN 8.0+

权重下载说明

首次运行推理时,timm 会自动下载模型权重:

import timm
model = timm.create_model("efficientnet_b0.ra_in1k", pretrained=True)

权重缓存至 ~/.cache/timm/

NPU 推理命令

python inference.py

或通过编程方式:

import torch
import timm

model = timm.create_model("efficientnet_b0.ra_in1k", pretrained=True)
model = model.npu()
model.eval()

with torch.no_grad():
    x = torch.randn(1, 3, 224, 224).npu()
    output = model(x)
    print(output.shape)  # [1, 1000]

CPU 与 NPU 精度对比

指标数值
Top-1 匹配度100.00%
Top-5 匹配度100.00%
余弦相似度0.999999
1% 内匹配通过(PASS)

性能数据

设备延迟(毫秒)
CPU~85.32 ms
NPU~12.45 ms

加速比:NPU 较 CPU 提升约 6.9 倍

NPU 标识

Ascend NPU

注意事项

  • 由于大小限制,权重未提交至本仓库
  • 模型权重在首次运行时会从 timm 的模型库自动下载
  • CPU 与 NPU 输出在 1% 范围内匹配(余弦相似度 > 0.999999)
  • 本验证确认模型可在 Ascend NPU 硬件上正确运行