From 7745bb1ed1c40beb9b29cc47af4193d6a5442aa2 Mon Sep 17 00:00:00 2001 From: Vasilis Vryniotis Date: Fri, 5 Feb 2021 11:27:41 +0000 Subject: [PATCH 1/4] Adding TODO placeholders. --- docs/source/models.rst | 3 +++ torchvision/models/mobilenetv3.py | 2 +- torchvision/models/quantization/mobilenetv3.py | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/source/models.rst b/docs/source/models.rst index 8d4d7260746..6a23852dbe8 100644 --- a/docs/source/models.rst +++ b/docs/source/models.rst @@ -64,6 +64,7 @@ These can be constructed by passing ``pretrained=True``: shufflenet = models.shufflenet_v2_x1_0(pretrained=True) mobilenet_v2 = models.mobilenet_v2(pretrained=True) mobilenet_v3_large = models.mobilenet_v3_large(pretrained=True) + mobilenet_v3_small = models.mobilenet_v3_small(pretrained=True) resnext50_32x4d = models.resnext50_32x4d(pretrained=True) wide_resnet50_2 = models.wide_resnet50_2(pretrained=True) mnasnet = models.mnasnet1_0(pretrained=True) @@ -142,6 +143,7 @@ GoogleNet 30.22 10.47 ShuffleNet V2 30.64 11.68 MobileNet V2 28.12 9.71 MobileNet V3 Large 25.96 8.66 +MobileNet V3 Small TODO TODO ResNeXt-50-32x4d 22.38 6.30 ResNeXt-101-32x8d 20.69 5.47 Wide ResNet-50-2 21.49 5.91 @@ -302,6 +304,7 @@ Model Acc@1 Acc@5 ================================ ============= ============= MobileNet V2 71.658 90.150 MobileNet V3 Large 73.004 90.858 +MobileNet V3 Small TODO TODO ShuffleNet V2 68.360 87.582 ResNet 18 69.494 88.882 ResNet 50 75.920 92.814 diff --git a/torchvision/models/mobilenetv3.py b/torchvision/models/mobilenetv3.py index f6117dcb989..4c6d793ed83 100644 --- a/torchvision/models/mobilenetv3.py +++ b/torchvision/models/mobilenetv3.py @@ -14,7 +14,7 @@ model_urls = { "mobilenet_v3_large": "https://download.pytorch.org/models/mobilenet_v3_large-8738ca79.pth", - "mobilenet_v3_small": None, + "mobilenet_v3_small": None, # TODO: Add URL } diff --git a/torchvision/models/quantization/mobilenetv3.py b/torchvision/models/quantization/mobilenetv3.py index eafe39bb041..efd759ce52b 100644 --- a/torchvision/models/quantization/mobilenetv3.py +++ b/torchvision/models/quantization/mobilenetv3.py @@ -13,7 +13,7 @@ quant_model_urls = { 'mobilenet_v3_large_qnnpack': "https://download.pytorch.org/models/quantized/mobilenet_v3_large_qnnpack-5bcacf28.pth", - 'mobilenet_v3_small_qnnpack': None, + 'mobilenet_v3_small_qnnpack': None, # TODO: Add URL } From f1c92fefed8dbbec9465cff404f4f5488043e132 Mon Sep 17 00:00:00 2001 From: Vasilis Vryniotis Date: Fri, 5 Feb 2021 11:57:11 +0000 Subject: [PATCH 2/4] More placeholders. --- references/classification/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/references/classification/README.md b/references/classification/README.md index 1694b25c7a8..0a43534521e 100644 --- a/references/classification/README.md +++ b/references/classification/README.md @@ -63,6 +63,12 @@ python -m torch.distributed.launch --nproc_per_node=8 --use_env train.py\ Then we averaged the parameters of the last 3 checkpoints that improved the Acc@1. See [#3182](https://github.com/pytorch/vision/pull/3182) for details. + +### MobileNetV3 Small + +TODO + + ## Mixed precision training Automatic Mixed Precision (AMP) training on GPU for Pytorch can be enabled with the [NVIDIA Apex extension](https://github.com/NVIDIA/apex). @@ -128,6 +134,8 @@ python -m torch.distributed.launch --nproc_per_node=8 --use_env train_quantizati --wd 0.00001 --lr 0.001 ``` +For MobileNet-v3 Small - TODO. + For post training quant, device is set to CPU. For training, the device is set to CUDA. ### Command to evaluate quantized models using the pre-trained weights: From 00542d95486feb18bda93ab6b8b7a694291151e9 Mon Sep 17 00:00:00 2001 From: Vasilis Vryniotis Date: Mon, 8 Feb 2021 12:20:59 +0000 Subject: [PATCH 3/4] Add MobileNetV3 small pre-trained weights. --- docs/source/models.rst | 2 +- references/classification/README.md | 12 +++++------- torchvision/models/mobilenetv3.py | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/docs/source/models.rst b/docs/source/models.rst index 6a23852dbe8..487b5a92f85 100644 --- a/docs/source/models.rst +++ b/docs/source/models.rst @@ -143,7 +143,7 @@ GoogleNet 30.22 10.47 ShuffleNet V2 30.64 11.68 MobileNet V2 28.12 9.71 MobileNet V3 Large 25.96 8.66 -MobileNet V3 Small TODO TODO +MobileNet V3 Small 32.33 12.60 ResNeXt-50-32x4d 22.38 6.30 ResNeXt-101-32x8d 20.69 5.47 Wide ResNet-50-2 21.49 5.91 diff --git a/references/classification/README.md b/references/classification/README.md index 0a43534521e..de0fb1fde3e 100644 --- a/references/classification/README.md +++ b/references/classification/README.md @@ -54,19 +54,17 @@ python -m torch.distributed.launch --nproc_per_node=8 --use_env train.py\ ``` -### MobileNetV3 Large +### MobileNetV3 Large & Small ``` python -m torch.distributed.launch --nproc_per_node=8 --use_env train.py\ - --model mobilenet_v3_large --epochs 600 --opt rmsprop --batch-size 128 --lr 0.064\ + --model $MODEL --epochs 600 --opt rmsprop --batch-size 128 --lr 0.064\ --wd 0.00001 --lr-step-size 2 --lr-gamma 0.973 --auto-augment imagenet --random-erase 0.2 ``` -Then we averaged the parameters of the last 3 checkpoints that improved the Acc@1. See [#3182](https://github.com/pytorch/vision/pull/3182) for details. +Here `$MODEL` is one of `mobilenet_v3_large` or `mobilenet_v3_small`. - -### MobileNetV3 Small - -TODO +Then we averaged the parameters of the last 3 checkpoints that improved the Acc@1. See [#3182](https://github.com/pytorch/vision/pull/3182) +and [#3354](https://github.com/pytorch/vision/pull/3354) for details. ## Mixed precision training diff --git a/torchvision/models/mobilenetv3.py b/torchvision/models/mobilenetv3.py index 4c6d793ed83..1e2606daa42 100644 --- a/torchvision/models/mobilenetv3.py +++ b/torchvision/models/mobilenetv3.py @@ -14,7 +14,7 @@ model_urls = { "mobilenet_v3_large": "https://download.pytorch.org/models/mobilenet_v3_large-8738ca79.pth", - "mobilenet_v3_small": None, # TODO: Add URL + "mobilenet_v3_small": "https://download.pytorch.org/models/mobilenet_v3_small-047dcff4.pth", } From 11d2cc05442ad33f3cb7bbe4e2a8bd40da78621d Mon Sep 17 00:00:00 2001 From: Vasilis Vryniotis Date: Tue, 9 Feb 2021 10:47:05 +0000 Subject: [PATCH 4/4] Remove placeholders. --- docs/source/models.rst | 1 - references/classification/README.md | 2 -- torchvision/models/quantization/mobilenetv3.py | 2 +- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/source/models.rst b/docs/source/models.rst index 0870c9f1bd6..3aba993a2c0 100644 --- a/docs/source/models.rst +++ b/docs/source/models.rst @@ -306,7 +306,6 @@ Model Acc@1 Acc@5 ================================ ============= ============= MobileNet V2 71.658 90.150 MobileNet V3 Large 73.004 90.858 -MobileNet V3 Small TODO TODO ShuffleNet V2 68.360 87.582 ResNet 18 69.494 88.882 ResNet 50 75.920 92.814 diff --git a/references/classification/README.md b/references/classification/README.md index de0fb1fde3e..7a3144b7cac 100644 --- a/references/classification/README.md +++ b/references/classification/README.md @@ -132,8 +132,6 @@ python -m torch.distributed.launch --nproc_per_node=8 --use_env train_quantizati --wd 0.00001 --lr 0.001 ``` -For MobileNet-v3 Small - TODO. - For post training quant, device is set to CPU. For training, the device is set to CUDA. ### Command to evaluate quantized models using the pre-trained weights: diff --git a/torchvision/models/quantization/mobilenetv3.py b/torchvision/models/quantization/mobilenetv3.py index efd759ce52b..eafe39bb041 100644 --- a/torchvision/models/quantization/mobilenetv3.py +++ b/torchvision/models/quantization/mobilenetv3.py @@ -13,7 +13,7 @@ quant_model_urls = { 'mobilenet_v3_large_qnnpack': "https://download.pytorch.org/models/quantized/mobilenet_v3_large_qnnpack-5bcacf28.pth", - 'mobilenet_v3_small_qnnpack': None, # TODO: Add URL + 'mobilenet_v3_small_qnnpack': None, }