本项目将 timm/edgenext_small.usi_in1k 图片分类模型适配到昇腾 NPU (Ascend910)。
timm.create_model(..., pretrained=False) + ModelScope 本地权重加载| 组件 | 版本/信息 |
|---|---|
| NPU | Ascend910 |
| CANN | 8.5.1 |
| PyTorch | torch + torch_npu |
| timm | latest |
| 设备状态 | npu_available=True, device=Ascend910_9362 |
环境详情见 logs/env_check.log。
pip install -r requirements.txt
python inference.py推理结果 (NPU Top-5):
日志保存在 logs/inference.log。
对单张测试图片进行 CPU 与 NPU 一致性验证:
| 指标 | 数值 |
|---|---|
| max_abs_error | 0.016106 |
| mean_abs_error | 0.003852 |
| relative_error | 0.3375% |
| cosine_similarity | 0.999995 |
| threshold | 1.0% |
| 结果 | PASS |
| 指标 | 数值 |
|---|---|
| 平均 latency | 0.008559 s |
| min latency | 0.008318 s |
| max latency | 0.008820 s |
| p50 latency | 0.008558 s |
| p90 latency | 0.008681 s |
| p95 latency | 0.008681 s |
| 吞吐量 | 116.84 images/sec |
日志保存在 logs/benchmark.log。
本项目包含单图 smoke consistency 验证,非官方 ImageNet 完整验证集评测。详细指标见第 4 节。
见 screenshots/self_verification.png 与 screenshots/self_verification.txt。
| 日志 | 说明 |
|---|---|
logs/env_check.log | NPU 环境检查 |
logs/inference.log | NPU 推理结果 |
logs/accuracy.log | CPU-NPU 精度一致性 |
logs/benchmark.log | 性能基准测试 |
logs/paths.txt | 模型与权重路径 |
snapshot_download 下载,严禁使用 pretrained=True 从 HuggingFace 自动下载。timm.data.resolve_model_data_config 获取输入尺寸(本模型为 256x256)。can not create directory 等日志警告,不影响实际推理,属于容器权限提示。#NPU #Ascend #Ascend910 #timm #EdgeNeXt #image-classification