将 timm/mobilevitv2_050.cvnets_in1k 模型适配至华为昇腾 NPU (Ascend910),使用 ModelScope snapshot_download 下载权重,timm.create_model(pretrained=False) 加载本地权重,包含推理验证、CPU-NPU 精度一致性检查和性能基准测试。
requirements.txtpip install -r requirements.txt
python inference.py推理结果(单张测试图片):
对单张测试图片进行 CPU 与 NPU 一致性验证:
| 指标 | 数值 |
|---|---|
| max_abs_error | 0.012425 |
| mean_abs_error | 0.003018 |
| relative_error | 0.2467% |
| cosine_similarity | 0.999997 |
| threshold | 1.0% |
| 结果 | PASS |
| 指标 | 数值 |
|---|---|
| avg latency | 10.14 ms |
| min latency | 7.38 ms |
| max latency | 33.10 ms |
| p50 | 7.59 ms |
| p90 | 10.40 ms |
| p95 | 21.75 ms |
| throughput | 98.58 images/sec |
| iterations | 10 |
本项目包含单图 smoke consistency 验证,非官方 ImageNet 完整验证集评测。详细指标见第 4 节。
见 screenshots/self_verification.png。
logs/inference.log — 推理结果logs/accuracy.log — 精度验证结果logs/benchmark.log — 性能基准测试结果timm.create_model(pretrained=False) 创建,权重从本地加载.bin, .safetensors, .pth 等)