本项目将 timm/mvitv2_small.fb_in1k (Multiscale Vision Transformer v2 Small) 适配到昇腾 NPU (Ascend910) 上运行。
| 项目 | 版本 |
|---|---|
| NPU | Ascend910 |
| CANN | 8.5.1 |
| PyTorch | 2.9.0+cpu |
| torch_npu | 可用 |
| timm | 最新 |
pip install -r requirements.txt
python inference.py推理结果 (NPU Top-5):
日志保存在 logs/inference.log。
对单张测试图片进行 CPU 与 NPU 一致性验证:
| 指标 | 数值 |
|---|---|
| max_abs_error | 0.003908 |
| mean_abs_error | 0.000776 |
| relative_error | 0.9180% |
| cosine_similarity | 0.999965 |
| threshold | 1.0% |
| 结果 | PASS |
| 指标 | 数值 |
|---|---|
| avg_time | 23.6232 ms |
| min_time | 22.7755 ms |
| max_time | 27.0210 ms |
| p50_time | 23.1418 ms |
| p90_time | 27.0210 ms |
| p95_time | 27.0210 ms |
| images_per_sec | 42.33 |
日志保存在 logs/benchmark.log。
本项目包含单图 smoke consistency 验证,非官方 ImageNet 完整验证集评测。详细指标见第 4 节。
见 screenshots/self_verification.png。
logs/inference.log - 推理结果logs/accuracy.log - 精度一致性验证logs/benchmark.log - 性能基准测试snapshot_download 下载,严禁使用 pretrained=True 从 HuggingFace 自动下载。timm.data.resolve_model_data_config 获取预处理配置。safetensors 格式。#NPU #Ascend #Ascend910 #ImageClassification