g
gyccc/timm-deit_base_distilled_patch16_224.fb_in1k-NPU
模型介绍文件和版本Pull Requests讨论分析
下载使用量0

timm/deit_base_distilled_patch16_224.fb_in1k on Ascend NPU

1. 简介

本项目将 timm/deit_base_distilled_patch16_224.fb_in1k (DeiT-Base distilled patch16 224, ImageNet-1k pretrained) 模型适配到昇腾 NPU (Ascend910),使其可在单卡 NPU 上正常推理。使用 ModelScope snapshot_download 下载权重,timm.create_model(pretrained=False) 加载本地权重,无 HuggingFace 自动下载。

2. 验证环境

  • 硬件:Ascend910 NPU
  • OS:Linux aarch64
  • Python:3.11
  • PyTorch:2.x
  • torch_npu:已安装
  • timm:已安装
  • 模型来源:ModelScope (timm/deit_base_distilled_patch16_224.fb_in1k)

3. 推理运行

pip install -r requirements.txt
python inference.py

推理结果 (NPU Top-5):

  • Top-1: class_657 (0.2966)
  • Top-2: class_795 (0.1989)
  • Top-3: class_744 (0.1311)
  • Top-4: class_3 (0.0604)
  • Top-5: class_974 (0.0363)

日志保存在 logs/inference.log。

4. 精度验证

对单张测试图片进行 CPU 与 NPU 一致性验证:

指标数值
max_abs_error0.034234
mean_abs_error0.006939
relative_error0.5664%
cosine_similarity0.999987
threshold1.0%
结果PASS
  • CPU Top-1: class_657
  • NPU Top-1: class_657
  • CPU Top-5: [657, 795, 744, 3, 974]
  • NPU Top-5: [657, 795, 744, 3, 974]
  • Top-1 match: True
  • Top-5 match: True

5. 性能参考

指标数值
平均延迟5.33 ms
最小延迟5.28 ms
最大延迟5.39 ms
P505.31 ms
P905.39 ms
P955.39 ms
吞吐量187.54 images/sec

6. 精度评测说明

本项目包含单图 smoke consistency 验证,非官方 ImageNet 完整验证集评测。详细指标见第 4 节。

7. 自验证截图

截图保存在 screenshots/self_verification.png。

8. 日志文件

  • logs/inference.log:推理结果日志
  • logs/accuracy.log:精度验证日志
  • logs/benchmark.log:性能基准日志
  • logs/env_check.log:环境检查日志

9. 注意事项

  • 使用 pretrained=False + ModelScope 本地权重加载,避免 HuggingFace 自动下载
  • 精度验证采用单图 smoke test,非官方完整验证集评测
  • DeiT-Base distilled 模型含 distillation head,推理时仅使用分类 head

10. 标签

#NPU #Ascend #Ascend910 #DeiT #ImageClassification #timm