本项目将 timm/tf_efficientnet_lite0.in1k 图片分类模型适配到昇腾 NPU (Ascend910)。
模型使用 ModelScope 下载本地权重,通过 timm.create_model(pretrained=False) 创建并加载权重,在 NPU 上完成推理验证、精度一致性检查和性能基准测试。
| 项目 | 版本/型号 |
|---|---|
| NPU | Ascend910 |
| npu-smi | 25.5.2 |
| CANN | 8.5.1 |
| PyTorch | 2.x |
| torch_npu | 2.x |
pip install -r requirements.txt
python inference.py推理结果 (NPU Top-5):
日志保存在 logs/inference.log。
对单张测试图片进行 CPU 与 NPU 一致性验证:
| 指标 | 数值 |
|---|---|
| max_abs_error | 0.000041 |
| mean_abs_error | 0.000009 |
| relative_error | 0.0274% |
| cosine_similarity | 1.000000 |
| threshold | 1.0% |
| 结果 | PASS |
| 指标 | 数值 |
|---|---|
| avg_time | 5.527 ms |
| min_time | 5.477 ms |
| max_time | 5.633 ms |
| p50_time | 5.519 ms |
| p90_time | 5.575 ms |
| p95_time | 5.604 ms |
| images_per_sec | 180.93 |
本项目包含单图 smoke consistency 验证,非官方 ImageNet 完整验证集评测。详细指标见第 4 节。
见 screenshots/self_verification.png。
logs/inference.log — 推理结果logs/accuracy.log — 精度一致性检查logs/benchmark.log — 性能基准测试logs/env_check.log — NPU 环境检查snapshot_download 下载,不提交到 Git 仓库。timm.create_model(..., pretrained=True) 从 HuggingFace 自动下载。#NPU #Ascend #Ascend910 #timm #efficientnet #image-classification