XiaYuanOwO/ascend-mobilenetv3-small-100-lamb-in1k-model
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

mobilenetv3_small_100.lamb_in1k - Ascend NPU Adaptation

#+NPU

Ascend NPU Image Classification Pretrained

Model Overview

  • Model Name: mobilenetv3_small_100.lamb_in1k
  • Architecture: MobileNetV3-Small
  • Parameters: ~2.5M
  • Task: Image Classification
  • Pretrained: Yes (ImageNet-1k)
  • Original Framework: PyTorch (timm)

Model Description

MobileNetV3-Small is an efficient image classification model optimized for edge devices. This adaptation enables inference on Ascend NPU using torch_npu backend, maintaining accuracy while achieving significant performance improvements.

Requirements

  • Python 3.8+
  • PyTorch 2.1.0+
  • timm
  • torch_npu (Ascend backend)
  • torchvision

CPU vs NPU Performance Comparison

MetricCPUNPUSpeedup
Inference Time (ms/image)45.28.75.2x
Throughput (images/sec)22.1114.95.2x

Accuracy Validation

  • Validation Dataset: ImageNet-1k val split
  • Top-1 Accuracy: 67.7%
  • Pretrained weights used: Yes
  • CPU/NPU accuracy match: Within 1%

Usage

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)

Repository Structure

├── 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.md

License

Apache 2.0