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

timm/tf_efficientnet_lite3.in1k on Ascend NPU

1. 简介

本项目将 timm/tf_efficientnet_lite3.in1k 图像分类模型适配到昇腾 NPU (Ascend910)。 模型通过 ModelScope snapshot_download 下载权重,本地加载后运行于 npu:0,支持单图推理、CPU-NPU 精度一致性验证和性能基准测试。

2. 验证环境

  • NPU: Ascend910
  • CANN: 8.5.1
  • PyTorch + torch_npu
  • input size: 300x300

3. 推理运行

pip install -r requirements.txt
python inference.py

推理结果 (NPU):

=== NPU Inference ===
model: timm/tf_efficientnet_lite3.in1k
input_shape: [1, 3, 300, 300]
output_shape: [1, 1000]

NPU Top-5 Predictions:
  Top-1: class_623 (0.008133)
  Top-2: class_680 (0.006732)
  Top-3: class_499 (0.006241)
  Top-4: class_902 (0.006224)
  Top-5: class_473 (0.006203)

日志保存在 logs/inference.log。

4. 精度验证

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

指标数值
max_abs_error0.003634
mean_abs_error0.000834
relative_error0.1525%
cosine_similarity0.999999
threshold1.0%
结果PASS

CPU Top-1: class_623, NPU Top-1: class_623 (match: True)
CPU Top-5: class_623, class_680, class_499, class_902, class_473
NPU Top-5: class_623, class_680, class_499, class_902, class_473
Top-5 match: True

5. 性能参考

指标数值
avg_latency_ms10.283
min_latency_ms9.483
max_latency_ms11.475
p50_latency_ms10.122
p90_latency_ms11.289
p95_latency_ms11.382
throughput_ips97.24

测试配置: warmup 2, runs 10, device npu:0, input [1, 3, 300, 300]

6. 精度评测说明

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

7. 自验证截图

见 screenshots/self_verification.png。

8. 日志文件

  • logs/inference.log — NPU 推理结果
  • logs/accuracy.log — CPU-NPU 精度一致性
  • logs/benchmark.log — 性能基准测试

9. 注意事项

  • 权重通过 ModelScope 自动下载到本地缓存,不在仓库中提交。
  • 若 NPU 设备不可用,推理将失败。
  • 测试图片 assets/test.jpg 为占位图(网络下载失败时生成的灰色图),仅用于 smoke test。

10. 标签

#NPU