本项目将 timm/tf_efficientnetv2_l.in21k 图片分类模型适配到昇腾 NPU (Ascend910) 上运行。模型使用 ImageNet-21k 预训练权重,输出 21843 类分类结果。
pip install -r requirements.txt
python inference.py推理结果 (NPU Top-5):
日志保存在 logs/inference.log。
对单张测试图片进行 CPU 与 NPU 一致性验证:
| 指标 | 数值 |
|---|---|
| max_abs_error | 0.011542 |
| mean_abs_error | 0.001574 |
| relative_error | 0.0884% |
| cosine_similarity | 1.000000 |
| threshold | 1.0% |
| 结果 | PASS |
| 指标 | 数值 |
|---|---|
| runs | 10 |
| avg_time(s) | 0.029828 |
| min_time(s) | 0.029593 |
| max_time(s) | 0.030373 |
| p50_time(s) | 0.029728 |
| p90_time(s) | 0.030373 |
| p95_time(s) | 0.030373 |
| images_per_sec | 33.53 |
本项目包含单图 smoke consistency 验证,非官方 ImageNet 完整验证集评测。详细指标见第 4 节。
见 screenshots/self_verification.png。
logs/inference.log — 推理结果logs/accuracy.log — CPU-NPU 精度一致性logs/benchmark.log — 性能基准测试timm.create_model(..., pretrained=False) 加载结构,通过 modelscope.snapshot_download 下载并本地加载权重。timm.data.resolve_model_data_config 自动获取。#NPU #Ascend #Ascend910 #timm #efficientnetv2