def block35(x, scale=1.0, activation_fn=tf.nn.relu, scope=None, reuse=None):
"""Builds the 35x35 resx block."""
with tf.variable_scope(scope, 'Block35', [x], reuse=reuse):
with tf.variable_scope('Branch_0'):
tower_conv = slim.conv2d(x, 32, 1, scope='Conv2d_1x1')
with tf.variable_scope('Branch_1'):
tower_conv1_0 = slim.conv2d(x, 32, 1, scope='Conv2d_0a_1x1')
tower_conv1_1 = slim.conv2d(tower_conv1_0, 32, 3, scope='Conv2d_0b_3x3')
with tf.variable_scope('Branch_2'):
tower_conv2_0 = slim.conv2d(x, 32, 1, scope='Conv2d_0a_1x1')
tower_conv2_1 = slim.conv2d(tower_conv2_0, 32, 3, scope='Conv2d_0b_3x3')
tower_conv2_2 = slim.conv2d(tower_conv2_1, 32, 3, scope='Conv2d_0c_3x3')
# tensor dimension: NxWxHxC, concat at dim-c
mixed = tf.concat([tower_conv, tower_conv1_1, tower_conv2_2], 3)
# output_num of up should be equal to input_num of layer
up = slim.conv2d(mixed, x.get_shape()[3], 1, normalizer_fn=None, activation_fn=None, scope='Conv2d_1x1')
x += scale * up
if activation_fn:
x = activation_fn(x)
return x
# Inception-ResNet-B
# (2 branches)
评论列表
文章目录