Skip to content

Commit 7fdb400

Browse files
authored
[New model] Support MobileNetV3 (open-mmlab#268)
* delete markdownlint * Support MobileNetV3 * fix import * add mobilenetv3 head and configs * Modify MobileNetV3 to semantic segmentation version * modify mobilenetv3 configs * add std configs * fix Conv2dAdaptivePadding bug * add configs * add unitest and fix bugs * fix lraspp unitest bugs * restore * fix unitest * add MobileNetV3 docstring * add mmcv * add mmcv * fix syntax bug * fix unitest bug * fix unitest bug * fix unitest bugs * fix docstring * add configs * restore * delete unnecessary assert * modify unitest * delete benchmark
1 parent 5dacca3 commit 7fdb400

21 files changed

+919
-16
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Supported backbones:
6060
- [x] [HRNet](configs/hrnet/README.md)
6161
- [x] [ResNeSt](configs/resnest/README.md)
6262
- [x] [MobileNetV2](configs/mobilenet_v2/README.md)
63+
- [x] [MobileNetV3](configs/mobilenet_v3/README.md)
6364

6465
Supported methods:
6566

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# model settings
2+
norm_cfg = dict(type='SyncBN', eps=0.001, requires_grad=True)
3+
model = dict(
4+
type='EncoderDecoder',
5+
backbone=dict(
6+
type='MobileNetV3',
7+
arch='large',
8+
out_indices=(1, 3, 16),
9+
norm_cfg=norm_cfg),
10+
decode_head=dict(
11+
type='LRASPPHead',
12+
in_channels=(16, 24, 960),
13+
in_index=(0, 1, 2),
14+
channels=128,
15+
input_transform='multiple_select',
16+
dropout_ratio=0.1,
17+
num_classes=19,
18+
norm_cfg=norm_cfg,
19+
act_cfg=dict(type='ReLU'),
20+
align_corners=False,
21+
loss_decode=dict(
22+
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)))
23+
# model training and testing settings
24+
train_cfg = dict()
25+
test_cfg = dict(mode='whole')

configs/mobilenet_v3/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Searching for MobileNetV3
2+
3+
## Introduction
4+
5+
```latex
6+
@inproceedings{Howard_2019_ICCV,
7+
title={Searching for MobileNetV3},
8+
author={Howard, Andrew and Sandler, Mark and Chu, Grace and Chen, Liang-Chieh and Chen, Bo and Tan, Mingxing and Wang, Weijun and Zhu, Yukun and Pang, Ruoming and Vasudevan, Vijay and Le, Quoc V. and Adam, Hartwig},
9+
booktitle={The IEEE International Conference on Computer Vision (ICCV)},
10+
pages={1314-1324},
11+
month={October},
12+
year={2019},
13+
doi={10.1109/ICCV.2019.00140}}
14+
}
15+
```
16+
17+
## Results and models
18+
19+
### Cityscapes
20+
21+
| Method | Backbone | Crop Size | Lr schd | Mem (GB) | Inf time (fps) | mIoU | mIoU(ms+flip) | download |
22+
|------------|----------|-----------|--------:|---------:|----------------|------:|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
23+
| LRASPP | M-V3-D8 | 512x1024 | 320000 | 8.9 | 15.22 | 69.54 | 70.89 | [model](https://download.openmmlab.com/mmsegmentation/v0.5/mobilenet_v3/lraspp_m-v3-d8_512x1024_320k_cityscapes/lraspp_m-v3-d8_512x1024_320k_cityscapes_20201224_220337-cfe8fb07.pth) | [log](https://download.openmmlab.com/mmsegmentation/v0.5/mobilenet_v3/lraspp_m-v3-d8_512x1024_320k_cityscapes/lraspp_m-v3-d8_512x1024_320k_cityscapes-20201224_220337.log.json)|
24+
| LRASPP | M-V3-D8 (scratch) | 512x1024 | 320000 | 8.9 | 14.77 | 67.87 | 69.78 | [model](https://download.openmmlab.com/mmsegmentation/v0.5/mobilenet_v3/lraspp_m-v3-d8_scratch_512x1024_320k_cityscapes/lraspp_m-v3-d8_scratch_512x1024_320k_cityscapes_20201224_220337-9f29cd72.pth) | [log](https://download.openmmlab.com/mmsegmentation/v0.5/mobilenet_v3/lraspp_m-v3-d8_scratch_512x1024_320k_cityscapes/lraspp_m-v3-d8_scratch_512x1024_320k_cityscapes-20201224_220337.log.json)|
25+
| LRASPP | M-V3s-D8 | 512x1024 | 320000 | 5.3 | 23.64 | 64.11 | 66.42 | [model](https://download.openmmlab.com/mmsegmentation/v0.5/mobilenet_v3/lraspp_m-v3s-d8_512x1024_320k_cityscapes/lraspp_m-v3s-d8_512x1024_320k_cityscapes_20201224_223935-61565b34.pth) | [log](https://download.openmmlab.com/mmsegmentation/v0.5/mobilenet_v3/lraspp_m-v3s-d8_512x1024_320k_cityscapes/lraspp_m-v3s-d8_512x1024_320k_cityscapes-20201224_223935.log.json)|
26+
| LRASPP | M-V3s-D8 (scratch) | 512x1024 | 320000 | 5.3 | 24.50 | 62.74 | 65.01 | [model](https://download.openmmlab.com/mmsegmentation/v0.5/mobilenet_v3/lraspp_m-v3s-d8_scratch_512x1024_320k_cityscapes/lraspp_m-v3s-d8_scratch_512x1024_320k_cityscapes_20201224_223935-03daeabb.pth) | [log](https://download.openmmlab.com/mmsegmentation/v0.5/mobilenet_v3/lraspp_m-v3s-d8_scratch_512x1024_320k_cityscapes/lraspp_m-v3s-d8_scratch_512x1024_320k_cityscapes-20201224_223935.log.json)|
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
_base_ = [
2+
'../_base_/models/lraspp_m-v3-d8.py', '../_base_/datasets/cityscapes.py',
3+
'../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py'
4+
]
5+
6+
model = dict(pretrained='open-mmlab://contrib/mobilenet_v3_large')
7+
8+
# Re-config the data sampler.
9+
data = dict(samples_per_gpu=4, workers_per_gpu=4)
10+
11+
runner = dict(type='IterBasedRunner', max_iters=320000)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
_base_ = [
2+
'../_base_/models/lraspp_m-v3-d8.py', '../_base_/datasets/cityscapes.py',
3+
'../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py'
4+
]
5+
6+
# Re-config the data sampler.
7+
data = dict(samples_per_gpu=4, workers_per_gpu=4)
8+
9+
runner = dict(type='IterBasedRunner', max_iters=320000)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
_base_ = './lraspp_m-v3-d8_512x1024_320k_cityscapes.py'
2+
norm_cfg = dict(type='SyncBN', eps=0.001, requires_grad=True)
3+
model = dict(
4+
type='EncoderDecoder',
5+
pretrained='open-mmlab://contrib/mobilenet_v3_small',
6+
backbone=dict(
7+
type='MobileNetV3',
8+
arch='small',
9+
out_indices=(0, 1, 12),
10+
norm_cfg=norm_cfg),
11+
decode_head=dict(
12+
type='LRASPPHead',
13+
in_channels=(16, 16, 576),
14+
in_index=(0, 1, 2),
15+
channels=128,
16+
input_transform='multiple_select',
17+
dropout_ratio=0.1,
18+
num_classes=19,
19+
norm_cfg=norm_cfg,
20+
act_cfg=dict(type='ReLU'),
21+
align_corners=False,
22+
loss_decode=dict(
23+
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)))
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
_base_ = './lraspp_m-v3-d8_scratch_512x1024_320k_cityscapes.py'
2+
norm_cfg = dict(type='SyncBN', eps=0.001, requires_grad=True)
3+
model = dict(
4+
type='EncoderDecoder',
5+
backbone=dict(
6+
type='MobileNetV3',
7+
arch='small',
8+
out_indices=(0, 1, 12),
9+
norm_cfg=norm_cfg),
10+
decode_head=dict(
11+
type='LRASPPHead',
12+
in_channels=(16, 16, 576),
13+
in_index=(0, 1, 2),
14+
channels=128,
15+
input_transform='multiple_select',
16+
dropout_ratio=0.1,
17+
num_classes=19,
18+
norm_cfg=norm_cfg,
19+
act_cfg=dict(type='ReLU'),
20+
align_corners=False,
21+
loss_decode=dict(
22+
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)))

docs/model_zoo.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ Please refer to [PointRend](https://github.com/open-mmlab/mmsegmentation/blob/ma
111111

112112
Please refer to [MobileNetV2](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/mobilenet_v2) for details.
113113

114+
### MobileNetV3
115+
116+
Please refer to [MobileNetV3](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/mobilenet_v3) for details.
117+
114118
### EMANet
115119

116120
Please refer to [EMANet](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/emanet) for details.

mmseg/models/backbones/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
from .fast_scnn import FastSCNN
33
from .hrnet import HRNet
44
from .mobilenet_v2 import MobileNetV2
5+
from .mobilenet_v3 import MobileNetV3
56
from .resnest import ResNeSt
67
from .resnet import ResNet, ResNetV1c, ResNetV1d
78
from .resnext import ResNeXt
89
from .unet import UNet
910

1011
__all__ = [
1112
'ResNet', 'ResNetV1c', 'ResNetV1d', 'ResNeXt', 'HRNet', 'FastSCNN',
12-
'ResNeSt', 'MobileNetV2', 'UNet', 'CGNet'
13+
'ResNeSt', 'MobileNetV2', 'UNet', 'CGNet', 'MobileNetV3'
1314
]

0 commit comments

Comments
 (0)