Skip to content

Commit 306c164

Browse files
authored
Updating documentation and weight locations. (#3242)
1 parent f883796 commit 306c164

File tree

5 files changed

+44
-8
lines changed

5 files changed

+44
-8
lines changed

docs/source/models.rst

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ architectures for image classification:
2222
- `Inception`_ v3
2323
- `GoogLeNet`_
2424
- `ShuffleNet`_ v2
25-
- `MobileNet`_ v2
25+
- `MobileNetV2`_
26+
- `MobileNetV3`_
2627
- `ResNeXt`_
2728
- `Wide ResNet`_
2829
- `MNASNet`_
@@ -40,7 +41,9 @@ You can construct a model with random weights by calling its constructor:
4041
inception = models.inception_v3()
4142
googlenet = models.googlenet()
4243
shufflenet = models.shufflenet_v2_x1_0()
43-
mobilenet = models.mobilenet_v2()
44+
mobilenet_v2 = models.mobilenet_v2()
45+
mobilenet_v3_large = models.mobilenet_v3_large()
46+
mobilenet_v3_small = models.mobilenet_v3_small()
4447
resnext50_32x4d = models.resnext50_32x4d()
4548
wide_resnet50_2 = models.wide_resnet50_2()
4649
mnasnet = models.mnasnet1_0()
@@ -59,7 +62,8 @@ These can be constructed by passing ``pretrained=True``:
5962
inception = models.inception_v3(pretrained=True)
6063
googlenet = models.googlenet(pretrained=True)
6164
shufflenet = models.shufflenet_v2_x1_0(pretrained=True)
62-
mobilenet = models.mobilenet_v2(pretrained=True)
65+
mobilenet_v2 = models.mobilenet_v2(pretrained=True)
66+
mobilenet_v3_large = models.mobilenet_v3_large(pretrained=True)
6367
resnext50_32x4d = models.resnext50_32x4d(pretrained=True)
6468
wide_resnet50_2 = models.wide_resnet50_2(pretrained=True)
6569
mnasnet = models.mnasnet1_0(pretrained=True)
@@ -137,6 +141,7 @@ Inception v3 22.55 6.44
137141
GoogleNet 30.22 10.47
138142
ShuffleNet V2 30.64 11.68
139143
MobileNet V2 28.12 9.71
144+
MobileNet V3 Large 25.96 8.66
140145
ResNeXt-50-32x4d 22.38 6.30
141146
ResNeXt-101-32x8d 20.69 5.47
142147
Wide ResNet-50-2 21.49 5.91
@@ -153,7 +158,8 @@ MNASNet 1.0 26.49 8.456
153158
.. _Inception: https://arxiv.org/abs/1512.00567
154159
.. _GoogLeNet: https://arxiv.org/abs/1409.4842
155160
.. _ShuffleNet: https://arxiv.org/abs/1807.11164
156-
.. _MobileNet: https://arxiv.org/abs/1801.04381
161+
.. _MobileNetV2: https://arxiv.org/abs/1801.04381
162+
.. _MobileNetV3: https://arxiv.org/abs/1905.02244
157163
.. _ResNeXt: https://arxiv.org/abs/1611.05431
158164
.. _MNASNet: https://arxiv.org/abs/1807.11626
159165

@@ -231,6 +237,12 @@ MobileNet v2
231237

232238
.. autofunction:: mobilenet_v2
233239

240+
MobileNet v3
241+
-------------
242+
243+
.. autofunction:: mobilenet_v3_large
244+
.. autofunction:: mobilenet_v3_small
245+
234246
ResNext
235247
-------
236248

@@ -351,6 +363,7 @@ Network box AP mask AP keypoint AP
351363
================================ ======= ======== ===========
352364
Faster R-CNN ResNet-50 FPN 37.0 - -
353365
RetinaNet ResNet-50 FPN 36.4 - -
366+
RetinaNet MobileNetV3-Large FPN 25.6 - -
354367
Mask R-CNN ResNet-50 FPN 37.9 34.6 -
355368
================================ ======= ======== ===========
356369

@@ -407,6 +420,7 @@ Network train time (s / it) test time (s / it) memory
407420
============================== =================== ================== ===========
408421
Faster R-CNN ResNet-50 FPN 0.2288 0.0590 5.2
409422
RetinaNet ResNet-50 FPN 0.2514 0.0939 4.1
423+
RetinaNet MobileNetV3-Large FPN 0.0928 0.0547 1.4
410424
Mask R-CNN ResNet-50 FPN 0.2728 0.0903 5.4
411425
Keypoint R-CNN ResNet-50 FPN 0.3789 0.1242 6.8
412426
============================== =================== ================== ===========
@@ -422,6 +436,7 @@ RetinaNet
422436
------------
423437

424438
.. autofunction:: torchvision.models.detection.retinanet_resnet50_fpn
439+
.. autofunction:: torchvision.models.detection.retinanet_mobilenet_v3_large_fpn
425440

426441

427442
Mask R-CNN

references/classification/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ python -m torch.distributed.launch --nproc_per_node=8 --use_env train.py\
5353
--lr-step-size 1 --lr-gamma 0.98
5454
```
5555

56+
57+
### MobileNetV3 Large
58+
```
59+
python -m torch.distributed.launch --nproc_per_node=8 --use_env train.py\
60+
--model mobilenet_v3_large --epochs 600 --opt rmsprop --batch-size 128 --lr 0.064\
61+
--wd 0.00001 --lr-step-size 2 --lr-gamma 0.973 --auto-augment imagenet --random-erase 0.2
62+
```
63+
64+
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.
65+
5666
## Mixed precision training
5767
Automatic Mixed Precision (AMP) training on GPU for Pytorch can be enabled with the [NVIDIA Apex extension](https://github.com/NVIDIA/apex).
5868

references/detection/README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,25 @@ python -m torch.distributed.launch --nproc_per_node=8 --use_env train.py\
2727
--lr-steps 16 22 --aspect-ratio-group-factor 3
2828
```
2929

30-
### RetinaNet
30+
31+
### RetinaNet with ResNet50 FPN
3132
```
3233
python -m torch.distributed.launch --nproc_per_node=8 --use_env train.py\
3334
--dataset coco --model retinanet_resnet50_fpn --epochs 26\
3435
--lr-steps 16 22 --aspect-ratio-group-factor 3 --lr 0.01
3536
```
3637

3738

39+
### RetinaNet with MobileNetV3 Large FPN
40+
```
41+
python -m torch.distributed.launch --nproc_per_node=8 --use_env train.py\
42+
--dataset coco --model retinanet_mobilenet_v3_large_fpn --epochs 26 --lr-steps 16 22\
43+
--aspect-ratio-group-factor 3 --lr 0.01
44+
```
45+
46+
Then we averaged the parameters of the last 2 checkpoints that improved the AP. See [#3223](https://github.com/pytorch/vision/pull/3223) for details.
47+
48+
3849
### Mask R-CNN
3950
```
4051
python -m torch.distributed.launch --nproc_per_node=8 --use_env train.py\

torchvision/models/detection/retinanet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ def forward(self, images, targets=None):
560560
# TODO: replace with pytorch links
561561
model_urls = {
562562
'retinanet_mobilenet_v3_large_fpn_coco':
563-
'https://github.com/datumbox/torchvision-models/raw/main/retinanet_mobilenet_v3_large_fpn-41c847a4.pth',
563+
'https://download.pytorch.org/models/retinanet_mobilenet_v3_large_fpn-41c847a4.pth',
564564
'retinanet_resnet50_fpn_coco':
565565
'https://download.pytorch.org/models/retinanet_resnet50_fpn_coco-eeacb38b.pth',
566566
}

torchvision/models/mobilenetv3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
# TODO: add pretrained
1616
model_urls = {
17-
"mobilenet_v3_large": "https://github.com/datumbox/torchvision-models/raw/main/mobilenet_v3_large-8738ca79.pth",
17+
"mobilenet_v3_large": "https://download.pytorch.org/models/mobilenet_v3_large-8738ca79.pth",
1818
"mobilenet_v3_small": None,
1919
}
2020

@@ -197,7 +197,7 @@ def _mobilenet_v3(
197197
**kwargs: Any
198198
):
199199
model = MobileNetV3(inverted_residual_setting, last_channel, **kwargs)
200-
if pretrained:
200+
if pretrained and model_urls[arch] is not None:
201201
state_dict = load_state_dict_from_url(model_urls[arch], progress=progress)
202202
model.load_state_dict(state_dict)
203203
return model

0 commit comments

Comments
 (0)