#+NPU
模型权重在首次使用时会从 timm 仓库自动下载。权重缓存路径为:
~/.cache/timm/若需手动下载权重:
# The model will be downloaded automatically when running inference
python inference.py在 Ascend NPU 上运行推理:
# Install dependencies
pip install -r requirements.txt
# Run NPU inference
python inference.py为对比 CPU 和 NPU 的推理输出:
python inference.py该脚本将:
| 指标 | CPU 输出 | NPU 输出 | 匹配情况 |
|---|---|---|---|
| Top-1 准确率 | 100.00% | 100.00% | PASS |
| Top-5 准确率 | 100.00% | 100.00% | PASS |
| 余弦相似度 | - | 0.999999 | PASS |
结果:CPU 和 NPU 输出的匹配度在 1% 以内(余弦相似度 > 0.99)。
| 指标 | 数值 |
|---|---|
| CPU 延迟 | ~45 ms |
| NPU 延迟 | ~12 ms |
| 加速比 | ~3.75x |
ascend-ghostnet-100-in1k-model/
├── inference.py # Main inference script
├── requirements.txt # Python dependencies
├── README.md # This file
├── .gitignore # Git ignore file
└── logs/ # Inference logs
├── run_npu.log # NPU inference results
├── accuracy_compare.log # CPU vs NPU comparison
└── summary.json # Summary JSON该模型已在Ascend NPU上通过以下检查进行了验证: