本项目将 timm/tf_efficientnetv2_s.in21k 图片分类模型适配到昇腾 NPU (Ascend910) 上运行。模型通过 ModelScope 下载本地权重,使用 timm.create_model(pretrained=False) 加载,支持单图推理、CPU-NPU 精度一致性验证和性能基准测试。
| 项目 | 版本/型号 |
|---|---|
| NPU | Ascend910 |
| CANN | 8.5.1 |
| torch | 2.x |
| torch_npu | 对应版本 |
| timm | 最新版 |
环境检查日志: logs/env_check.log
pip install -r requirements.txt
python inference.py推理结果 (NPU Top-5):
日志保存在 logs/inference.log。
对单张测试图片进行 CPU 与 NPU 一致性验证:
| 指标 | 数值 |
|---|---|
| max_abs_error | 0.011463 |
| mean_abs_error | 0.001405 |
| relative_error | 0.0705% |
| cosine_similarity | 1.000000 |
| threshold | 1.0% |
| 结果 | PASS |
| 指标 | 数值 |
|---|---|
| avg_latency_ms | 18.51 |
| min_latency_ms | 17.88 |
| max_latency_ms | 18.93 |
| p50_latency_ms | 18.72 |
| p90_latency_ms | 18.93 |
| p95_latency_ms | 18.93 |
| images_per_sec | 54.01 |
日志保存在 logs/benchmark.log。
本项目包含单图 smoke consistency 验证,非官方 ImageNet 完整验证集评测。详细指标见第 4 节。
见 screenshots/self_verification.png。
logs/env_check.log — 环境检查logs/inference.log — 推理结果logs/accuracy.log — 精度验证logs/benchmark.log — 性能基准snapshot_download 自动下载到本地缓存目录,不会随项目提交。#NPU #Ascend #Ascend910 #timm #EfficientNetV2 #ImageClassification