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

timm/tf_efficientnet_cc_b1_8e.in1k on Ascend NPU

1. 简介

本项目将 timm/tf_efficientnet_cc_b1_8e.in1k 图像分类模型适配到昇腾 NPU (Ascend910) 上运行。模型基于 EfficientNet-CC-B1 (8e) 架构,在 ImageNet-1k 上训练,支持 1000 类图像分类。

2. 验证环境

项目版本/型号
NPUAscend910
CANN8.5.1
PyTorch2.x
torch_npu已安装
timm最新版

环境检查日志见 logs/env_check.log。

3. 推理运行

pip install -r requirements.txt
python inference.py

推理结果 (NPU):

=== NPU Inference Result ===
Model: timm/tf_efficientnet_cc_b1_8e.in1k
Input: assets/test.jpg
Output shape: torch.Size([1, 1000])

Top-5 Predictions:
  1. class_idx=437, prob=0.2115
  2. class_idx=975, prob=0.1197
  3. class_idx=978, prob=0.0831
  4. class_idx=417, prob=0.0752
  5. class_idx=972, prob=0.0311

日志保存在 logs/inference.log。

4. 精度验证

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

指标数值
max_abs_error0.005554
mean_abs_error0.000848
relative_error0.1151%
cosine_similarity0.999999
threshold1.0%
结果PASS

5. 性能参考

在 Ascend910 单卡 NPU 上,输入尺寸 [1, 3, 240, 240]:

指标数值
avg_latency_ms13.095
min_latency_ms12.640
max_latency_ms13.315
p50_latency_ms13.199
p90_latency_ms13.315
p95_latency_ms13.315
throughput_ips76.36

日志保存在 logs/benchmark.log。

6. 精度评测说明

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

7. 自验证截图

见 screenshots/self_verification.txt 和 screenshots/self_verification.png。

8. 日志文件

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

9. 注意事项

  • 权重通过 modelscope.snapshot_download 下载,本地加载,禁止 HuggingFace 自动下载
  • 推理使用 pretrained=False + 本地 safetensors 权重
  • 预处理使用 timm 标准 resolve_model_data_config + create_transform

10. 标签

#NPU #Ascend #Ascend910 #ImageClassification