本项目将 timm/mobilevitv2_050.cvnets_in1k 图片分类模型适配到华为昇腾 NPU(Ascend910)上运行。
安装依赖:
pip install -r requirements.txtpython inference.py推理结果示例(单张测试图片):
| Rank | Class | Probability |
|---|---|---|
| 1 | class_718 | 0.338753 |
| 2 | class_839 | 0.111917 |
| 3 | class_510 | 0.042591 |
| 4 | class_540 | 0.040586 |
| 5 | class_517 | 0.018986 |
对单张测试图片进行 CPU 与 NPU 一致性验证:
| 指标 | 数值 |
|---|---|
| max_abs_error | 0.009037 |
| mean_abs_error | 0.002274 |
| relative_error | 0.2336% |
| cosine_similarity | 0.999997 |
| threshold | 1.0% |
| 结果 | PASS |
| 指标 | 数值 |
|---|---|
| Warmup | 2 |
| Runs | 10 |
| avg latency | 0.006726 sec |
| min latency | 0.006635 sec |
| max latency | 0.006813 sec |
| p50 latency | 0.006726 sec |
| p90 latency | 0.006796 sec |
| p95 latency | 0.006805 sec |
| Throughput | 148.68 images/sec |
本项目包含单图 smoke consistency 验证,非官方 ImageNet 完整验证集评测。详细指标见第 4 节。
见 screenshots/self_verification.png
logs/inference.log — 推理结果logs/accuracy.log — CPU-NPU 精度一致性logs/benchmark.log — 性能基准测试pretrained=False 并通过 load_state_dict 加载本地权重#NPU #Ascend #Ascend910 #ImageClassification #timm #MobileViTv2