w
gcw_uQ09W7jl/timm-tf_efficientnet_b7.ns_jft_in1k-NPU
模型介绍文件和版本Pull Requests讨论分析
下载使用量0

timm/tf_efficientnet_b7.ns_jft_in1k on Ascend NPU

1. 简介

本项目将 timm/tf_efficientnet_b7.ns_jft_in1k 图像分类模型适配到单卡昇腾 NPU (Ascend910) 上运行。

模型类型:图像分类 (ImageNet-1k, 1000 classes) 架构:EfficientNet-B7 (by timm)

2. 验证环境

项目版本
NPUAscend910
CANN8.5.1
PyTorch2.x
torch_npu与 CANN 8.5.1 配套
timmlatest

环境检查日志:logs/env_check.log

3. 推理运行

pip install -r requirements.txt
python inference.py

推理结果 (NPU):

=== NPU Inference Result ===
Model: timm/tf_efficientnet_b7.ns_jft_in1k
Input shape: [1, 3, 600, 600]
Output shape: [1, 1000]
Output dtype: torch.float32

Top-5 predictions:
  1. class_idx=90, prob=0.154358
  2. class_idx=323, prob=0.146251
  3. class_idx=94, prob=0.065332
  4. class_idx=990, prob=0.052615
  5. class_idx=325, prob=0.043770

Raw logits (first 10):
  [-0.4266427159309387, 0.1474224179983139, -0.7499443292617798, -0.05899123474955559, -0.8420599699020386, -0.3052010238170624, -0.6180973052978516, -0.7152126431465149, -0.682157576084137, -0.3898557722568512]

日志保存在 logs/inference.log。

4. 精度验证

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

指标数值
max_abs_error0.006737
mean_abs_error0.000486
relative_error0.0927%
cosine_similarity1.000000
threshold1.0%
结果PASS

5. 性能参考

指标数值
avg_latency34.001 ms
min_latency32.924 ms
max_latency35.354 ms
p50_latency33.798 ms
p90_latency35.300 ms
p95_latency35.327 ms
throughput29.41 samples/s

注:性能数据在单卡 Ascend910 上测得,实际数值可能因负载、温度、驱动版本而波动。

6. 精度评测说明

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

7. 自验证截图

  • 文本摘要:screenshots/self_verification.txt
  • 截图:screenshots/self_verification.png

8. 日志文件

文件说明
logs/env_check.logNPU 环境检查
logs/inference.logNPU 推理输出
logs/accuracy.logCPU-NPU 精度一致性
logs/benchmark.logNPU 性能基准测试

9. 注意事项

  • 权重通过 ModelScope snapshot_download 自动下载到本地缓存,首次运行需要联网。
  • 推理脚本使用 pretrained=False + 本地 safetensors 权重加载,不依赖 HuggingFace 自动下载。
  • 测试图片下载失败时会使用占位灰度图,预测结果仅供演示。

10. 标签

#NPU #Ascend #Ascend910 #ImageClassification #timm