def _block_a_reduce(net, endpoints, k=192, l=224, m=256, n=384, scope='BlockReduceA'):
# 35 x 35 -> 17 x 17 reduce
# inception-v4: k=192, l=224, m=256, n=384
# inception-resnet-v1: k=192, l=192, m=256, n=384
# inception-resnet-v2: k=256, l=256, m=384, n=384
# default padding = VALID
# default stride = 1
with arg_scope([layers.conv2d, layers.max_pool2d, layers.avg_pool2d], padding='VALID'):
with tf.variable_scope(scope):
with tf.variable_scope('Br1_Pool'):
br1 = layers.max_pool2d(net, [3, 3], stride=2, scope='Pool1_3x3/2')
# 17 x 17 x input
with tf.variable_scope('Br2_3x3'):
br2 = layers.conv2d(net, n, [3, 3], stride=2, scope='Conv1_3x3/2')
# 17 x 17 x n
with tf.variable_scope('Br3_3x3Dbl'):
br3 = layers.conv2d(net, k, [1, 1], padding='SAME', scope='Conv1_1x1')
br3 = layers.conv2d(br3, l, [3, 3], padding='SAME', scope='Conv2_3x3')
br3 = layers.conv2d(br3, m, [3, 3], stride=2, scope='Conv3_3x3/2')
# 17 x 17 x m
net = tf.concat(3, [br1, br2, br3], name='Concat1')
# 17 x 17 x input + n + m
# 1024 for v4 (384 + 384 + 256)
# 896 for res-v1 (256 + 384 +256)
# 1152 for res-v2 (384 + 384 + 384)
endpoints[scope] = net
print('%s output shape: %s' % (scope, net.get_shape()))
return net
build_inception_v4.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录