未验证 提交 29a5c2fa 编写于 作者: W Wenyu 提交者: GitHub

use bias (#6234)

上级 8693e1d0
...@@ -37,7 +37,8 @@ class HRFPN(nn.Layer): ...@@ -37,7 +37,8 @@ class HRFPN(nn.Layer):
out_channel=256, out_channel=256,
share_conv=False, share_conv=False,
extra_stage=1, 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__() super(HRFPN, self).__init__()
in_channel = sum(in_channels) in_channel = sum(in_channels)
self.in_channel = in_channel self.in_channel = in_channel
...@@ -47,12 +48,14 @@ class HRFPN(nn.Layer): ...@@ -47,12 +48,14 @@ class HRFPN(nn.Layer):
spatial_scales = spatial_scales + [spatial_scales[-1] / 2.] spatial_scales = spatial_scales + [spatial_scales[-1] / 2.]
self.spatial_scales = spatial_scales self.spatial_scales = spatial_scales
self.num_out = len(self.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( self.reduction = nn.Conv2D(
in_channels=in_channel, in_channels=in_channel,
out_channels=out_channel, out_channels=out_channel,
kernel_size=1, kernel_size=1,
bias_attr=False) bias_attr=bias_attr)
if share_conv: if share_conv:
self.fpn_conv = nn.Conv2D( self.fpn_conv = nn.Conv2D(
...@@ -60,7 +63,7 @@ class HRFPN(nn.Layer): ...@@ -60,7 +63,7 @@ class HRFPN(nn.Layer):
out_channels=out_channel, out_channels=out_channel,
kernel_size=3, kernel_size=3,
padding=1, padding=1,
bias_attr=False) bias_attr=bias_attr)
else: else:
self.fpn_conv = [] self.fpn_conv = []
for i in range(self.num_out): for i in range(self.num_out):
...@@ -72,7 +75,7 @@ class HRFPN(nn.Layer): ...@@ -72,7 +75,7 @@ class HRFPN(nn.Layer):
out_channels=out_channel, out_channels=out_channel,
kernel_size=3, kernel_size=3,
padding=1, padding=1,
bias_attr=False)) bias_attr=bias_attr))
self.fpn_conv.append(conv) self.fpn_conv.append(conv)
def forward(self, body_feats): def forward(self, body_feats):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册