本项目将 timm/dpn68.mx_in1k 图片分类模型适配到单卡昇腾 NPU (Ascend910)。
模型信息:
| 项目 | 版本/型号 |
|---|---|
| NPU | Ascend910 |
| CANN | 8.5.1 |
| PyTorch | 2.x |
| torch_npu | 适配 CANN 8.5.1 |
pip install -r requirements.txt
python inference.py推理结果 (NPU Top-5):
日志保存在 logs/inference.log。
对单张测试图片进行 CPU 与 NPU 一致性验证:
| 指标 | 数值 |
|---|---|
| max_abs_error | 0.012742 |
| mean_abs_error | 0.002880 |
| relative_error | 0.3112% |
| cosine_similarity | 0.999995 |
| threshold | 1.0% |
| 结果 | PASS |
| 指标 | 数值 |
|---|---|
| avg_latency_ms | 9.03 |
| min_latency_ms | 8.96 |
| max_latency_ms | 9.08 |
| p50_latency_ms | 9.03 |
| p90_latency_ms | 9.08 |
| p95_latency_ms | 9.08 |
| images_per_sec | 110.72 |
本项目包含单图 smoke consistency 验证,非官方 ImageNet 完整验证集评测。详细指标见第 4 节。
见 screenshots/self_verification.png。
| 文件 | 说明 |
|---|---|
logs/inference.log | 推理结果日志 |
logs/accuracy.log | CPU-NPU 精度一致性日志 |
logs/benchmark.log | 性能基准测试日志 |
logs/env_check.log | NPU 环境检查日志 |
snapshot_download 本地加载,严禁使用 pretrained=True 从 HuggingFace 自动下载。timm.data.resolve_model_data_config 自动解析。.gitignore,不会提交到仓库。#NPU #Ascend #Ascend910 #DPN #ImageClassification