本项目将 timm/inception_v3.tf_in1k 图片分类模型适配到昇腾 NPU(Ascend910)上运行。使用 ModelScope 下载本地权重,通过 timm.create_model(pretrained=False) 加载,包含推理验证、CPU-NPU 精度一致性检查和性能基准测试。
| 项目 | 版本/型号 |
|---|---|
| NPU | Ascend910 |
| CANN | 8.5.1 |
| PyTorch | 2.x |
| torch_npu | 可用 |
| timm | 最新版 |
详细环境信息见 logs/env_check.log。
pip install -r requirements.txt
python inference.py推理结果 (NPU Top-5):
日志保存在 logs/inference.log。
对单张测试图片进行 CPU 与 NPU 一致性验证:
| 指标 | 数值 |
|---|---|
| max_abs_error | 0.019538 |
| mean_abs_error | 0.003563 |
| relative_error | 0.3902% |
| cosine_similarity | 0.999993 |
| threshold | 1.0% |
| 结果 | PASS |
| 指标 | 数值 |
|---|---|
| avg_latency | 0.011283s |
| min_latency | 0.011227s |
| max_latency | 0.011488s |
| p50_latency | 0.011253s |
| p90_latency | 0.011488s |
| p95_latency | 0.011488s |
| throughput | 88.63 images/sec |
日志保存在 logs/benchmark.log。
本项目包含单图 smoke consistency 验证,非官方 ImageNet 完整验证集评测。详细指标见第 4 节。
见 screenshots/self_verification.png。
logs/env_check.log — NPU 环境检查logs/inference.log — NPU 推理结果logs/accuracy.log — CPU-NPU 精度一致性logs/benchmark.log — NPU 性能基准snapshot_download 本地加载,严禁 pretrained=True 自动从 HuggingFace 下载。timm.data.resolve_model_data_config 自动解析。npu:0 真实设备运行。#NPU #Ascend #Ascend910 #timm #inception_v3 #image-classification