本项目将 timm/inception_next_base.sail_in1k 适配到昇腾 NPU(Ascend910)。使用 ModelScope snapshot_download 下载权重,通过 timm.create_model(..., pretrained=False) 创建模型并加载本地权重,实现了推理验证、CPU-NPU 精度一致性检查和性能基准测试。
| 项目 | 版本/型号 |
|---|---|
| NPU | Ascend910 |
| CANN | 8.5.1 |
| torch | 2.x |
| torch_npu | 适配 CANN 8.5.1 |
pip install -r requirements.txt
python inference.py推理结果 (NPU Top-5):
日志保存在 logs/inference.log。
对单张测试图片进行 CPU 与 NPU 一致性验证:
| 指标 | 数值 |
|---|---|
| max_abs_error | 0.029974 |
| mean_abs_error | 0.005203 |
| relative_error | 0.9882% |
| cosine_similarity | 0.999964 |
| threshold | 1.0% |
| 结果 | PASS |
| 指标 | 数值 |
|---|---|
| avg latency | 12.407 ms |
| min latency | 11.927 ms |
| max latency | 12.558 ms |
| p50 latency | 12.449 ms |
| p90 latency | 12.558 ms |
| p95 latency | 12.558 ms |
| Throughput | 80.60 images/sec |
日志保存在 logs/benchmark.log。
本项目包含单图 smoke consistency 验证,非官方 ImageNet 完整验证集评测。详细指标见第 4 节。
见 screenshots/self_verification.png。
logs/env_check.log — 环境检查logs/inference.log — 推理结果logs/accuracy.log — 精度一致性logs/benchmark.log — 性能基准timm.create_model 必须使用 pretrained=False,再加载本地权重。npu:0 上执行。#NPU #Ascend #Ascend910 #timm #MetaNeXt #image-classification