Skip to content

Commit 0c31afe

Browse files
谢昕辰xvjiarui
谢昕辰
andauthored
Support fcn dilate 6 (open-mmlab#400)
* Support fcn dilate 6 * Support dilate in FCNHead * configs for cityscapse dataset * add configs for pytorch pretrained model * update README * add fps test results * add memory test results and links * modify log names * Update mmseg/models/decode_heads/fcn_head.py Co-authored-by: Jerry Jiarui XU <[email protected]>
1 parent 7e1b24d commit 0c31afe

14 files changed

+76
-3
lines changed

configs/fcn/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@
3939
| FCN | R-18b-D8 | 769x769 | 80000 | 1.7 | 6.70 | 69.66 | 72.07 | [model](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_r18b-d8_769x769_80k_cityscapes/fcn_r18b-d8_769x769_80k_cityscapes_20201226_004430-32d504e5.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_r18b-d8_769x769_80k_cityscapes/fcn_r18b-d8_769x769_80k_cityscapes-20201226_004430.log.json) |
4040
| FCN | R-50b-D8 | 769x769 | 80000 | 6.3 | 1.82 | 73.83 | 76.60 | [model](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_r50b-d8_769x769_80k_cityscapes/fcn_r50b-d8_769x769_80k_cityscapes_20201225_094223-94552d38.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_r50b-d8_769x769_80k_cityscapes/fcn_r50b-d8_769x769_80k_cityscapes-20201225_094223.log.json) |
4141
| FCN | R-101b-D8| 769x769 | 80000 | 10.3 | 1.15 | 77.02 | 78.67 | [model](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_r101b-d8_769x769_80k_cityscapes/fcn_r101b-d8_769x769_80k_cityscapes_20201226_170012-82be37e2.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_r101b-d8_769x769_80k_cityscapes/fcn_r101b-d8_769x769_80k_cityscapes-20201226_170012.log.json) |
42+
|FCN-D6|R-50-D16|512x1024|40000|3.4|10.22|77.06|78.85| [model](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r50-d16_512x1024_40k_cityscapes/fcn_d6_r50-d16_512x1024_40k_cityscapes-98d5d1bc.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r50-d16_512x1024_40k_cityscapes/fcn_d6_r50-d16_512x1024_40k_cityscapes-20210305_130133.log.json)|
43+
|FCN-D6|R-50-D16|512x1024|80000|-|10.35|77.27|78.88| [model](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r50-d16_512x1024_80k_cityscapes/fcn_d6_r50-d16_512x1024_40k_cityscapes-98d5d1bc.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r50-d16_512x1024_80k_cityscapes/fcn_d6_r50-d16_512x1024_80k_cityscapes-20210306_115604.log.json) |
44+
|FCN-D6|R-50-D16|769x769|40000|3.7|4.17|76.82|78.22| [model](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r50-d16_769x769_40k_cityscapes/fcn_d6_r50-d16_769x769_40k_cityscapes-1aab18ed.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r50-d16_769x769_40k_cityscapes/fcn_d6_r50-d16_769x769_40k_cityscapes-20210305_185744.log.json) |
45+
|FCN-D6|R-50-D16|769x769|80000|-|4.15|77.04|78.40| [model](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r50-d16_769x769_80k_cityscapes/fcn_d6_r50-d16_769x769_80k_cityscapes-109d88eb.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r50-d16_769x769_80k_cityscapes/fcn_d6_r50-d16_769x769_80k_cityscapes-20210305_200413.log.json) |
46+
|FCN-D6|R-101-D16|512x1024|40000|4.5|8.04|77.36|79.18| [model](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r101-d16_512x1024_40k_cityscapes/fcn_d6_r101-d16_512x1024_40k_cityscapes-9cf2b450.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r101-d16_512x1024_40k_cityscapes/fcn_d6_r101-d16_512x1024_40k_cityscapes-20210305_130337.log.json) |
47+
|FCN-D6|R-101-D16|512x1024|80000|-|8.26|78.46|80.42| [model](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r101-d16_512x1024_80k_cityscapes/fcn_d6_r101-d16_512x1024_80k_cityscapes-cb336445.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r101-d16_512x1024_80k_cityscapes/fcn_d6_r101-d16_512x1024_80k_cityscapes-20210308_102747.log.json) |
48+
|FCN-D6|R-101-D16|769x769|40000|5.0|3.12|77.28|78.95| [model](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r101-d16_769x769_40k_cityscapes/fcn_d6_r101-d16_769x769_40k_cityscapes-60b114e9.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r101-d16_769x769_40k_cityscapes/fcn_d6_r101-d16_769x769_40k_cityscapes-20210308_102453.log.json) |
49+
|FCN-D6|R-101-D16|769x769|80000|-|3.21|78.06|79.58| [model](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r101-d16_769x769_80k_cityscapes/fcn_d6_r101-d16_769x769_80k_cityscapes-e33adc4f.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r101-d16_769x769_80k_cityscapes/fcn_d6_r101-d16_769x769_80k_cityscapes-20210306_120016.log.json) |
50+
|FCN-D6|R-50b-D16|512x1024|80000|3.2|10.16|76.99|79.03| [model](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r50b_d16_512x1024_80k_cityscapes/fcn_d6_r50b_d16_512x1024_80k_cityscapes-6a0b62e9.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r50b_d16_512x1024_80k_cityscapes/fcn_d6_r50b_d16_512x1024_80k_cityscapes-20210311_125550.log.json) |
51+
|FCN-D6|R-50b-D16|769x769|80000|3.6|4.17|76.86|78.52| [model](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r50b_d16_769x769_80k_cityscapes/fcn_d6_r50b_d16_769x769_80k_cityscapes-d665f231.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r50b_d16_769x769_80k_cityscapes/fcn_d6_r50b_d16_769x769_80k_cityscapes-20210311_131012.log.json) |
52+
|FCN-D6|R-101b-D16|512x1024|80000|4.3|8.46|77.72|79.53| [model](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r101b_d16_512x1024_80k_cityscapes/fcn_d6_r101b_d16_512x1024_80k_cityscapes-3f2eb5b4.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r101b_d16_512x1024_80k_cityscapes/fcn_d6_r101b_d16_512x1024_80k_cityscapes-20210311_144305.log.json) |
53+
|FCN-D6|R-101b-D16|769x769|80000|4.8|3.32|77.34|78.91| [model](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r101b_d16_769x769_80k_cityscapes/fcn_d6_r101b_d16_769x769_80k_cityscapes-c4d8bfbc.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r101b_d16_769x769_80k_cityscapes/fcn_d6_r101b_d16_769x769_80k_cityscapes-20210311_154527.log.json) |
4254

4355
### ADE20K
4456

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_base_ = './fcn_d6_r50-d16_512x1024_40k_cityscapes.py'
2+
model = dict(pretrained='open-mmlab://resnet101_v1c', backbone=dict(depth=101))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_base_ = './fcn_d6_r50-d16_512x1024_80k_cityscapes.py'
2+
model = dict(pretrained='open-mmlab://resnet101_v1c', backbone=dict(depth=101))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_base_ = './fcn_d6_r50-d16_769x769_40k_cityscapes.py'
2+
model = dict(pretrained='open-mmlab://resnet101_v1c', backbone=dict(depth=101))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_base_ = './fcn_d6_r50-d16_769x769_80k_cityscapes.py'
2+
model = dict(pretrained='open-mmlab://resnet101_v1c', backbone=dict(depth=101))
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
_base_ = './fcn_d6_r50b-d16_512x1024_80k_cityscapes.py'
2+
model = dict(
3+
pretrained='torchvision://resnet101',
4+
backbone=dict(type='ResNet', depth=101))
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
_base_ = './fcn_d6_r50b-d16_769x769_80k_cityscapes.py'
2+
model = dict(
3+
pretrained='torchvision://resnet101',
4+
backbone=dict(type='ResNet', depth=101))
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
_base_ = [
2+
'../_base_/models/fcn_r50-d8.py', '../_base_/datasets/cityscapes.py',
3+
'../_base_/default_runtime.py', '../_base_/schedules/schedule_40k.py'
4+
]
5+
model = dict(
6+
backbone=dict(dilations=(1, 1, 1, 2), strides=(1, 2, 2, 1)),
7+
decode_head=dict(dilation=6),
8+
auxiliary_head=dict(dilation=6))
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
_base_ = [
2+
'../_base_/models/fcn_r50-d8.py', '../_base_/datasets/cityscapes.py',
3+
'../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py'
4+
]
5+
model = dict(
6+
backbone=dict(dilations=(1, 1, 1, 2), strides=(1, 2, 2, 1)),
7+
decode_head=dict(dilation=6),
8+
auxiliary_head=dict(dilation=6))
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
_base_ = [
2+
'../_base_/models/fcn_r50-d8.py',
3+
'../_base_/datasets/cityscapes_769x769.py', '../_base_/default_runtime.py',
4+
'../_base_/schedules/schedule_40k.py'
5+
]
6+
model = dict(
7+
backbone=dict(dilations=(1, 1, 1, 2), strides=(1, 2, 2, 1)),
8+
decode_head=dict(align_corners=True, dilation=6),
9+
auxiliary_head=dict(align_corners=True, dilation=6),
10+
test_cfg=dict(mode='slide', crop_size=(769, 769), stride=(513, 513)))
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
_base_ = [
2+
'../_base_/models/fcn_r50-d8.py',
3+
'../_base_/datasets/cityscapes_769x769.py', '../_base_/default_runtime.py',
4+
'../_base_/schedules/schedule_80k.py'
5+
]
6+
model = dict(
7+
backbone=dict(dilations=(1, 1, 1, 2), strides=(1, 2, 2, 1)),
8+
decode_head=dict(align_corners=True, dilation=6),
9+
auxiliary_head=dict(align_corners=True, dilation=6),
10+
test_cfg=dict(mode='slide', crop_size=(769, 769), stride=(513, 513)))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_base_ = './fcn_d6_r50-d16_512x1024_80k_cityscapes.py'
2+
model = dict(pretrained='torchvision://resnet50', backbone=dict(type='ResNet'))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_base_ = './fcn_d6_r50-d16_769x769_80k_cityscapes.py'
2+
model = dict(pretrained='torchvision://resnet50', backbone=dict(type='ResNet'))

mmseg/models/decode_heads/fcn_head.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,32 @@ class FCNHead(BaseDecodeHead):
1717
kernel_size (int): The kernel size for convs in the head. Default: 3.
1818
concat_input (bool): Whether concat the input and output of convs
1919
before classification layer.
20+
dilation (int): The dilation rate for convs in the head. Default: 1.
2021
"""
2122

2223
def __init__(self,
2324
num_convs=2,
2425
kernel_size=3,
2526
concat_input=True,
27+
dilation=1,
2628
**kwargs):
27-
assert num_convs >= 0
29+
assert num_convs >= 0 and dilation > 0 and isinstance(dilation, int)
2830
self.num_convs = num_convs
2931
self.concat_input = concat_input
3032
self.kernel_size = kernel_size
3133
super(FCNHead, self).__init__(**kwargs)
3234
if num_convs == 0:
3335
assert self.in_channels == self.channels
3436

37+
conv_padding = (kernel_size // 2) * dilation
3538
convs = []
3639
convs.append(
3740
ConvModule(
3841
self.in_channels,
3942
self.channels,
4043
kernel_size=kernel_size,
41-
padding=kernel_size // 2,
44+
padding=conv_padding,
45+
dilation=dilation,
4246
conv_cfg=self.conv_cfg,
4347
norm_cfg=self.norm_cfg,
4448
act_cfg=self.act_cfg))
@@ -48,7 +52,8 @@ def __init__(self,
4852
self.channels,
4953
self.channels,
5054
kernel_size=kernel_size,
51-
padding=kernel_size // 2,
55+
padding=conv_padding,
56+
dilation=dilation,
5257
conv_cfg=self.conv_cfg,
5358
norm_cfg=self.norm_cfg,
5459
act_cfg=self.act_cfg))

0 commit comments

Comments
 (0)