Skip to content

Commit 2eb13c6

Browse files
Improve structure and readability for FCNHead (open-mmlab#2142)
1 parent 0391dcd commit 2eb13c6

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

mmseg/models/decode_heads/fcn_head.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,21 @@ def __init__(self,
3737

3838
conv_padding = (kernel_size // 2) * dilation
3939
convs = []
40-
convs.append(
41-
ConvModule(
42-
self.in_channels,
43-
self.channels,
44-
kernel_size=kernel_size,
45-
padding=conv_padding,
46-
dilation=dilation,
47-
conv_cfg=self.conv_cfg,
48-
norm_cfg=self.norm_cfg,
49-
act_cfg=self.act_cfg))
50-
for i in range(num_convs - 1):
40+
for i in range(num_convs):
41+
_in_channels = self.in_channels if i == 0 else self.channels
5142
convs.append(
5243
ConvModule(
53-
self.channels,
44+
_in_channels,
5445
self.channels,
5546
kernel_size=kernel_size,
5647
padding=conv_padding,
5748
dilation=dilation,
5849
conv_cfg=self.conv_cfg,
5950
norm_cfg=self.norm_cfg,
60-
act_cfg=self.act_cfg))
61-
if num_convs == 0:
51+
act_cfg=self.act_cfg
52+
))
53+
54+
if len(convs) == 0:
6255
self.convs = nn.Identity()
6356
else:
6457
self.convs = nn.Sequential(*convs)

0 commit comments

Comments
 (0)