本项目将 timm/mobilenetv3_large_100.ra_in1k 图片分类模型适配到华为昇腾 NPU(Ascend910)上运行。
安装依赖:
pip install -r requirements.txtpython inference.py推理结果示例(单张测试图片):
| Rank | Class | Probability |
|---|---|---|
| 1 | class_599 | 0.0325 |
| 2 | class_109 | 0.0308 |
| 3 | class_305 | 0.0248 |
| 4 | class_853 | 0.0234 |
| 5 | class_984 | 0.0224 |
对单张测试图片进行 CPU 与 NPU 一致性验证:
| 指标 | 数值 |
|---|---|
| max_abs_error | 0.017525 |
| mean_abs_error | 0.003075 |
| relative_error | 0.2853% |
| cosine_similarity | 0.999996 |
| threshold | 1.0% |
| 结果 | PASS |
| 指标 | 数值 |
|---|---|
| Warmup | 2 |
| Runs | 10 |
| avg latency | 13.306 ms |
| min latency | 11.795 ms |
| max latency | 17.546 ms |
| p50 latency | 12.673 ms |
| p90 latency | 17.546 ms |
| p95 latency | 17.546 ms |
| Throughput | 75.16 images/sec |
本项目包含单图 smoke consistency 验证,非官方 ImageNet 完整验证集评测。详细指标见第 4 节。
见 screenshots/self_verification.png
logs/inference.log — 推理结果logs/accuracy.log — CPU-NPU 精度一致性logs/benchmark.log — 性能基准测试| 项目 | 链接 |
|---|---|
| 原始权重模型地址 | https://modelscope.cn/models/timm/mobilenetv3_large_100.ra_in1k |
| 提交项目地址 | https://ai.gitcode.com/v50_/timm-mobilenetv3_large_100.ra_in1k-NPU |
提交说明:适配 timm/mobilenetv3_large_100.ra_in1k 到昇腾 NPU (Ascend910)。使用 ModelScope snapshot_download 下载权重,timm.create_model(pretrained=False) 加载本地权重,包含推理验证、CPU-NPU 精度一致性检查和性能基准测试。
pretrained=False 并通过 load_state_dict 加载本地权重#NPU #Ascend #Ascend910 #ImageClassification #timm