Improve structure and readability for FCNHead (#2142)

This commit is contained in:
Edward 2022-10-08 08:31:17 +00:00 committed by GitHub
parent 0391dcd105
commit 2eb13c6906
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,28 +37,21 @@ class FCNHead(BaseDecodeHead):
conv_padding = (kernel_size // 2) * dilation
convs = []
convs.append(
ConvModule(
self.in_channels,
self.channels,
kernel_size=kernel_size,
padding=conv_padding,
dilation=dilation,
conv_cfg=self.conv_cfg,
norm_cfg=self.norm_cfg,
act_cfg=self.act_cfg))
for i in range(num_convs - 1):
for i in range(num_convs):
_in_channels = self.in_channels if i == 0 else self.channels
convs.append(
ConvModule(
self.channels,
_in_channels,
self.channels,
kernel_size=kernel_size,
padding=conv_padding,
dilation=dilation,
conv_cfg=self.conv_cfg,
norm_cfg=self.norm_cfg,
act_cfg=self.act_cfg))
if num_convs == 0:
act_cfg=self.act_cfg
))
if len(convs) == 0:
self.convs = nn.Identity()
else:
self.convs = nn.Sequential(*convs)