提交 4e5b60c0 编写于 作者: W weishengyu

remove name of ConvBN

上级 9b61df62
...@@ -114,8 +114,7 @@ class TransitionLayer(TheseusLayer): ...@@ -114,8 +114,7 @@ class TransitionLayer(TheseusLayer):
ConvBNLayer( ConvBNLayer(
num_channels=in_channels[i], num_channels=in_channels[i],
num_filters=out_channels[i], num_filters=out_channels[i],
filter_size=3, filter_size=3))
name=name + '_layer_' + str(i + 1)))
else: else:
residual = self.add_sublayer( residual = self.add_sublayer(
"transition_{}_layer_{}".format(name, i + 1), "transition_{}_layer_{}".format(name, i + 1),
...@@ -123,8 +122,7 @@ class TransitionLayer(TheseusLayer): ...@@ -123,8 +122,7 @@ class TransitionLayer(TheseusLayer):
num_channels=in_channels[-1], num_channels=in_channels[-1],
num_filters=out_channels[i], num_filters=out_channels[i],
filter_size=3, filter_size=3,
stride=2, stride=2))
name=name + '_layer_' + str(i + 1)))
self.conv_bn_func_list.append(residual) self.conv_bn_func_list.append(residual)
def forward(self, x, res_dict=None): def forward(self, x, res_dict=None):
...@@ -193,29 +191,25 @@ class BottleneckBlock(TheseusLayer): ...@@ -193,29 +191,25 @@ class BottleneckBlock(TheseusLayer):
num_channels=num_channels, num_channels=num_channels,
num_filters=num_filters, num_filters=num_filters,
filter_size=1, filter_size=1,
act="relu", act="relu")
name=name + "_conv1", )
self.conv2 = ConvBNLayer( self.conv2 = ConvBNLayer(
num_channels=num_filters, num_channels=num_filters,
num_filters=num_filters, num_filters=num_filters,
filter_size=3, filter_size=3,
stride=stride, stride=stride,
act="relu", act="relu")
name=name + "_conv2")
self.conv3 = ConvBNLayer( self.conv3 = ConvBNLayer(
num_channels=num_filters, num_channels=num_filters,
num_filters=num_filters * 4, num_filters=num_filters * 4,
filter_size=1, filter_size=1,
act=None, act=None)
name=name + "_conv3")
if self.downsample: if self.downsample:
self.conv_down = ConvBNLayer( self.conv_down = ConvBNLayer(
num_channels=num_channels, num_channels=num_channels,
num_filters=num_filters * 4, num_filters=num_filters * 4,
filter_size=1, filter_size=1,
act=None, act=None)
name=name + "_downsample")
if self.has_se: if self.has_se:
self.se = SELayer( self.se = SELayer(
...@@ -259,23 +253,20 @@ class BasicBlock(TheseusLayer): ...@@ -259,23 +253,20 @@ class BasicBlock(TheseusLayer):
num_filters=num_filters, num_filters=num_filters,
filter_size=3, filter_size=3,
stride=stride, stride=stride,
act="relu", act="relu")
name=name + "_conv1")
self.conv2 = ConvBNLayer( self.conv2 = ConvBNLayer(
num_channels=num_filters, num_channels=num_filters,
num_filters=num_filters, num_filters=num_filters,
filter_size=3, filter_size=3,
stride=1, stride=1,
act=None, act=None)
name=name + "_conv2")
if self.downsample: if self.downsample:
self.conv_down = ConvBNLayer( self.conv_down = ConvBNLayer(
num_channels=num_channels, num_channels=num_channels,
num_filters=num_filters * 4, num_filters=num_filters * 4,
filter_size=1, filter_size=1,
act="relu", act="relu")
name=name + "_downsample")
if self.has_se: if self.has_se:
self.se = SELayer( self.se = SELayer(
...@@ -429,9 +420,7 @@ class FuseLayers(TheseusLayer): ...@@ -429,9 +420,7 @@ class FuseLayers(TheseusLayer):
num_filters=out_channels[i], num_filters=out_channels[i],
filter_size=1, filter_size=1,
stride=1, stride=1,
act=None, act=None))
name=name + '_layer_' + str(i + 1) + '_' +
str(j + 1)))
self.residual_func_list.append(residual_func) self.residual_func_list.append(residual_func)
elif j < i: elif j < i:
pre_num_filters = in_channels[j] pre_num_filters = in_channels[j]
...@@ -445,9 +434,7 @@ class FuseLayers(TheseusLayer): ...@@ -445,9 +434,7 @@ class FuseLayers(TheseusLayer):
num_filters=out_channels[i], num_filters=out_channels[i],
filter_size=3, filter_size=3,
stride=2, stride=2,
act=None, act=None))
name=name + '_layer_' + str(i + 1) + '_' +
str(j + 1) + '_' + str(k + 1)))
pre_num_filters = out_channels[i] pre_num_filters = out_channels[i]
else: else:
residual_func = self.add_sublayer( residual_func = self.add_sublayer(
...@@ -458,9 +445,7 @@ class FuseLayers(TheseusLayer): ...@@ -458,9 +445,7 @@ class FuseLayers(TheseusLayer):
num_filters=out_channels[j], num_filters=out_channels[j],
filter_size=3, filter_size=3,
stride=2, stride=2,
act="relu", act="relu"))
name=name + '_layer_' + str(i + 1) + '_' +
str(j + 1) + '_' + str(k + 1)))
pre_num_filters = out_channels[j] pre_num_filters = out_channels[j]
self.residual_func_list.append(residual_func) self.residual_func_list.append(residual_func)
...@@ -544,16 +529,14 @@ class HRNet(TheseusLayer): ...@@ -544,16 +529,14 @@ class HRNet(TheseusLayer):
num_filters=64, num_filters=64,
filter_size=3, filter_size=3,
stride=2, stride=2,
act='relu', act='relu')
name="layer1_1")
self.conv_layer1_2 = ConvBNLayer( self.conv_layer1_2 = ConvBNLayer(
num_channels=64, num_channels=64,
num_filters=64, num_filters=64,
filter_size=3, filter_size=3,
stride=2, stride=2,
act='relu', act='relu')
name="layer1_2")
self.la1 = Layer1(num_channels=64, has_se=has_se, name="layer2") self.la1 = Layer1(num_channels=64, has_se=has_se, name="layer2")
...@@ -603,15 +586,13 @@ class HRNet(TheseusLayer): ...@@ -603,15 +586,13 @@ class HRNet(TheseusLayer):
num_channels=num_filters_list[idx] * 4, num_channels=num_filters_list[idx] * 4,
num_filters=last_num_filters[idx], num_filters=last_num_filters[idx],
filter_size=3, filter_size=3,
stride=2, stride=2)))
name="cls_head_add" + str(idx + 1))))
self.conv_last = ConvBNLayer( self.conv_last = ConvBNLayer(
num_channels=1024, num_channels=1024,
num_filters=2048, num_filters=2048,
filter_size=1, filter_size=1,
stride=1, stride=1)
name="cls_head_last_conv")
self.pool2d_avg = AdaptiveAvgPool2D(1) self.pool2d_avg = AdaptiveAvgPool2D(1)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册