本项目将 timm/efficientnet_lite0.ra_in1k 图片分类模型适配到昇腾 NPU (Ascend910)。
模型类型:EfficientNet-Lite0 (image classification, 1000 classes) 适配方式:ModelScope snapshot_download 下载权重,timm.create_model(pretrained=False) 加载本地权重。
| 项目 | 版本/说明 |
|---|---|
| NPU | Ascend910 |
| CANN | 8.5.1 |
| PyTorch | 2.x |
| torch_npu | 适配版本 |
详见 logs/env_check.log。
pip install -r requirements.txt
python inference.py推理结果 (NPU Top-5):
日志保存在 logs/inference.log。
对单张测试图片进行 CPU 与 NPU 一致性验证:
| 指标 | 数值 |
|---|---|
| max_abs_error | 0.013282 |
| mean_abs_error | 0.002771 |
| relative_error | 0.2257% |
| cosine_similarity | 0.999997 |
| threshold | 1.0% |
| 结果 | PASS |
| 指标 | 数值 |
|---|---|
| avg_latency | 5.432 ms |
| min_latency | 5.362 ms |
| max_latency | 5.485 ms |
| p50_latency | 5.431 ms |
| p90_latency | 5.485 ms |
| p95_latency | 5.485 ms |
| throughput | 184.08 images/sec |
日志保存在 logs/benchmark.log。
本项目包含单图 smoke consistency 验证,非官方 ImageNet 完整验证集评测。详细指标见第 4 节。
见 screenshots/self_verification.png 与 screenshots/self_verification.txt。
logs/env_check.log — NPU 环境信息logs/inference.log — 推理结果logs/accuracy.log — CPU-NPU 精度一致性logs/benchmark.log — 性能基准测试pretrained=True 从 HuggingFace 自动下载。timm.data.resolve_model_data_config 获取模型对应的数据预处理配置。#NPU #Ascend #EfficientNet #timm #image-classification