本项目将 timm/ghostnet_100.in1k 图片分类模型适配到华为昇腾 NPU(Ascend910)上运行。
安装依赖:
pip install -r requirements.txtpython inference.py推理结果示例(单张测试图片):
| Rank | Class | Probability |
|---|---|---|
| 1 | class_649 | 0.6169 |
| 2 | class_972 | 0.0386 |
| 3 | class_825 | 0.0111 |
| 4 | class_500 | 0.0108 |
| 5 | class_210 | 0.0108 |
对单张测试图片进行 CPU 与 NPU 一致性验证:
| 指标 | 数值 |
|---|---|
| max_abs_error | 0.005627 |
| mean_abs_error | 0.001117 |
| relative_error | 0.1317% |
| cosine_similarity | 0.999999 |
| threshold | 1.0% |
| 结果 | PASS |
| 指标 | 数值 |
|---|---|
| Warmup | 2 |
| Runs | 10 |
| avg latency | 22.380 ms |
| min latency | 18.701 ms |
| max latency | 28.235 ms |
| p50 latency | 21.130 ms |
| p90 latency | 28.235 ms |
| p95 latency | 28.235 ms |
| Throughput | 44.68 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/ghostnet_100.in1k |
| 提交项目地址 | https://ai.gitcode.com/v50_/timm-ghostnet_100.in1k-NPU |
提交说明:适配 timm/ghostnet_100.in1k 到昇腾 NPU (Ascend910)。使用 ModelScope snapshot_download 下载权重,timm.create_model(pretrained=False) 加载本地权重,包含推理验证、CPU-NPU 精度一致性检查和性能基准测试。
pretrained=False 并通过 load_state_dict 加载本地权重#NPU #Ascend #Ascend910 #ImageClassification #timm