Commit 2f9e2c0e authored by Yuxin Wu's avatar Yuxin Wu

revert the local change to resnet_model

parent 5ef0578f
...@@ -81,12 +81,7 @@ def resnet_bottleneck(l, ch_out, stride, stride_first=False): ...@@ -81,12 +81,7 @@ def resnet_bottleneck(l, ch_out, stride, stride_first=False):
""" """
shortcut = l shortcut = l
l = Conv2D('conv1', l, ch_out, 1, strides=stride if stride_first else 1, activation=BNReLU) l = Conv2D('conv1', l, ch_out, 1, strides=stride if stride_first else 1, activation=BNReLU)
if stride == 2: l = Conv2D('conv2', l, ch_out, 3, strides=1 if stride_first else stride, activation=BNReLU)
l = tf.pad(l, [[0,0],[0,0],[1,1],[1,1]])
l = Conv2D('conv2', l, ch_out, 3, strides=1 if stride_first else
stride, activation=BNReLU, padding='VALID')
else:
l = Conv2D('conv2', l, ch_out, 3, strides=1 if stride_first else stride, activation=BNReLU)
l = Conv2D('conv3', l, ch_out * 4, 1, activation=get_bn(zero_init=True)) l = Conv2D('conv3', l, ch_out * 4, 1, activation=get_bn(zero_init=True))
return l + resnet_shortcut(shortcut, ch_out * 4, stride, activation=get_bn(zero_init=False)) return l + resnet_shortcut(shortcut, ch_out * 4, stride, activation=get_bn(zero_init=False))
...@@ -122,11 +117,8 @@ def resnet_backbone(image, num_blocks, group_func, block_func): ...@@ -122,11 +117,8 @@ def resnet_backbone(image, num_blocks, group_func, block_func):
with argscope(Conv2D, use_bias=False, with argscope(Conv2D, use_bias=False,
kernel_initializer=tf.variance_scaling_initializer(scale=2.0, mode='fan_out')): kernel_initializer=tf.variance_scaling_initializer(scale=2.0, mode='fan_out')):
logits = (LinearWrap(image) logits = (LinearWrap(image)
.tf.pad([[0,0],[0,0],[3,3],[3,3]]) .Conv2D('conv0', 64, 7, strides=2, activation=BNReLU)
.Conv2D('conv0', 64, 7, strides=2, activation=BNReLU, .MaxPooling('pool0', shape=3, stride=2, padding='SAME')
padding='VALID')
.tf.pad([[0,0],[0,0],[1,1],[1,1]])
.MaxPooling('pool0', shape=3, stride=2, padding='VALID')
.apply(group_func, 'group0', block_func, 64, num_blocks[0], 1) .apply(group_func, 'group0', block_func, 64, num_blocks[0], 1)
.apply(group_func, 'group1', block_func, 128, num_blocks[1], 2) .apply(group_func, 'group1', block_func, 128, num_blocks[1], 2)
.apply(group_func, 'group2', block_func, 256, num_blocks[2], 2) .apply(group_func, 'group2', block_func, 256, num_blocks[2], 2)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment