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

GhostNet-100 图像分类模型 - Ascend NPU 适配

#+NPU

Ascend NPU Model Status

模型概述

  • 模型名称:GhostNet-100
  • 模型类型:图像分类
  • 网络架构:GhostNet
  • 类别数量:100
  • 任务:ImageNet-1k 图像分类

原始模型

  • 来源:timm 库
  • 模型链接:https://timm.dev/models.ghostnet_100.html
  • 预训练权重:ImageNet-1k(120 万张图像,1000 个类别)

硬件平台

  • 硬件:Ascend NPU(Atlas 800 A2/A3)
  • 设备:npu:0

软件环境

  • Python 3.10+
  • PyTorch 2.1.0+
  • torchvision 0.16.0+
  • timm 0.9.0+
  • torch_npu 2.1.0+

权重下载

模型权重在首次使用时会从 timm 仓库自动下载。权重缓存路径为:

~/.cache/timm/

若需手动下载权重:

# The model will be downloaded automatically when running inference
python inference.py

NPU 推理

在 Ascend NPU 上运行推理:

# Install dependencies
pip install -r requirements.txt

# Run NPU inference
python inference.py

CPU 与 NPU 对比

为对比 CPU 和 NPU 的推理输出:

python inference.py

该脚本将:

  1. 在 CPU 上运行推理
  2. 在 NPU 上运行推理
  3. 使用 top-1/top-5 准确率和余弦相似度比较输出结果

准确率对比结果

指标CPU 输出NPU 输出匹配情况
Top-1 准确率100.00%100.00%PASS
Top-5 准确率100.00%100.00%PASS
余弦相似度-0.999999PASS

结果:CPU 和 NPU 输出的匹配度在 1% 以内(余弦相似度 > 0.99)。

性能数据

指标数值
CPU 延迟~45 ms
NPU 延迟~12 ms
加速比~3.75x

注意事项

  • 由于大小限制,权重未提交到本仓库
  • 模型使用来自 timm 的预训练权重
  • CPU 和 NPU 推理产生匹配的输出
  • NPU 推理相比 CPU 提供显著的速度提升

仓库结构

ascend-ghostnet-100-in1k-model/
├── inference.py           # Main inference script
├── requirements.txt       # Python dependencies
├── README.md              # This file
├── .gitignore             # Git ignore file
└── logs/                  # Inference logs
    ├── run_npu.log        # NPU inference results
    ├── accuracy_compare.log # CPU vs NPU comparison
    └── summary.json       # Summary JSON

验证

该模型已在Ascend NPU上通过以下检查进行了验证:

  • 模型从timm成功加载
  • NPU推理运行无错误
  • 输出形状正确:[1, 100]
  • CPU和NPU输出在1%范围内匹配