本项目将 timm/hgnet_tiny.paddle_in1k 图片分类模型适配到昇腾 NPU(Ascend910B)运行。
timm.create_model(pretrained=False) 本地加载| 项目 | 版本 |
|---|---|
| NPU | Ascend910B |
| CANN | 8.5.1 |
| torch_npu | 2.x |
| PyTorch | 2.x |
| timm | latest |
pip install -r requirements.txt
python inference.py推理结果 (NPU Top-5):
日志保存在 logs/inference.log。
对单张测试图片进行 CPU 与 NPU 一致性验证:
| 指标 | 数值 |
|---|---|
| max_abs_error | 0.003865 |
| mean_abs_error | 0.000602 |
| relative_error | 0.0726% |
| cosine_similarity | 1.000000 |
| threshold | 1.0% |
| 结果 | PASS |
| 指标 | 数值 |
|---|---|
| avg_latency | 4.309 ms |
| min_latency | 4.229 ms |
| max_latency | 4.386 ms |
| p50_latency | 4.330 ms |
| p90_latency | 4.386 ms |
| p95_latency | 4.386 ms |
| images/sec | 232.09 |
日志保存在 logs/benchmark.log。
本项目包含单图 smoke consistency 验证,非官方 ImageNet 完整验证集评测。详细指标见第 4 节。
见 screenshots/self_verification.png。
logs/inference.log — 推理结果logs/accuracy.log — CPU-NPU 精度一致性logs/benchmark.log — 性能基准测试timm.create_model(..., pretrained=True) 从 HuggingFace 自动下载,权重通过 ModelScope snapshot_download 本地加载。npu:0。relative_error < 1.0%。#NPU #Ascend #Ascend910 #timm #image-classification