#+NPU
MobileNetV3-Small是一款为边缘设备优化的高效图像分类模型。本适配版本通过torch_npu后端实现了在昇腾NPU上的推理,在保持精度的同时实现了显著的性能提升。
| 指标 | CPU | NPU | 加速比 |
|---|---|---|---|
| 推理时间(毫秒/张) | 45.2 | 8.7 | 5.2倍 |
| 吞吐量(张/秒) | 22.1 | 114.9 | 5.2倍 |
import torch
import timm
# Load model
model = timm.create_model('mobilenetv3_small_100.lamb_in1k', pretrained=True)
# Move to NPU
model = model.to('npu')
# Inference
input_tensor = torch.randn(1, 3, 224, 224).npu()
output = model(input_tensor)├── inference.py # Main inference script with CPU/NPU comparison
├── requirements.txt # Python dependencies
├── logs/ # Execution logs
│ ├── run_npu.log
│ ├── accuracy_compare.log
│ └── summary.json
└── README.mdApache 2.0