Home

Awesome

MobileNetv2 in PyTorch

An implementation of MobileNetv2 in PyTorch. MobileNetv2 is an efficient convolutional neural network architecture for mobile devices. For more information check the paper: Inverted Residuals and Linear Bottlenecks: Mobile Networks for Classification, Detection and Segmentation

Usage

Clone the repo:

git clone https://github.com/Randl/MobileNetV2-pytorch
pip install -r requirements.txt

Use the model defined in model.py to run ImageNet example:

python imagenet.py --dataroot "/path/to/imagenet/"

To run continue training from checkpoint

python imagenet.py --dataroot "/path/to/imagenet/" --resume "/path/to/checkpoint/folder"

Results

For x1.0 model I achieved 0.3% higher top-1 accuracy than claimed.

Classification CheckpointMACs (M)Parameters (M)Top-1 AccuracyTop-5 AccuracyClaimed top-1Claimed top-5
[mobilenet_v2_1.0_224]3003.4772.1090.4871.891.0
[mobilenet_v2_0.5_160]501.9560.6182.8761.083.2

You can test it with

python imagenet.py --dataroot "/path/to/imagenet/" --resume "results/mobilenet_v2_1.0_224/model_best.pth.tar" -e
python imagenet.py --dataroot "/path/to/imagenet/" --resume "results/mobilenet_v2_0.5_160/model_best.pth.tar" -e --scaling 0.5 --input-size 160