diff --git a/ppdet/modeling/necks/hrfpn.py b/ppdet/modeling/necks/hrfpn.py index eb4768b8ecba7c11dcd834265e1289db8d6ec7b0..5c45c9974b3bd213747cc7b6f0f5f670f38c61bf 100644 --- a/ppdet/modeling/necks/hrfpn.py +++ b/ppdet/modeling/necks/hrfpn.py @@ -37,7 +37,8 @@ class HRFPN(nn.Layer): out_channel=256, share_conv=False, extra_stage=1, - spatial_scales=[1. / 4, 1. / 8, 1. / 16, 1. / 32]): + spatial_scales=[1. / 4, 1. / 8, 1. / 16, 1. / 32], + use_bias=False): super(HRFPN, self).__init__() in_channel = sum(in_channels) self.in_channel = in_channel @@ -47,12 +48,14 @@ class HRFPN(nn.Layer): spatial_scales = spatial_scales + [spatial_scales[-1] / 2.] self.spatial_scales = spatial_scales self.num_out = len(self.spatial_scales) + self.use_bias = use_bias + bias_attr = False if use_bias is False else None self.reduction = nn.Conv2D( in_channels=in_channel, out_channels=out_channel, kernel_size=1, - bias_attr=False) + bias_attr=bias_attr) if share_conv: self.fpn_conv = nn.Conv2D( @@ -60,7 +63,7 @@ class HRFPN(nn.Layer): out_channels=out_channel, kernel_size=3, padding=1, - bias_attr=False) + bias_attr=bias_attr) else: self.fpn_conv = [] for i in range(self.num_out): @@ -72,7 +75,7 @@ class HRFPN(nn.Layer): out_channels=out_channel, kernel_size=3, padding=1, - bias_attr=False)) + bias_attr=bias_attr)) self.fpn_conv.append(conv) def forward(self, body_feats):