def convolution_block_2(layer_input, fine_grained_features, num_convolutions, keep_prob, activation_fn, is_training): x = tf.concat((layer_input, fine_grained_features), axis=-1) n_channels = get_num_channels(layer_input) if num_convolutions == 1: with tf.variable_scope('conv_' + str(1)): x = convolution(x, [5, 5, 5, n_channels * 2, n_channels]) x = tf.layers.batch_normalization(x, momentum=0.99, epsilon=0.001,center=True, scale=True,training=is_training) # layer_input = tf.layers.batch_normalization(layer_input, momentum=0.99, epsilon=0.001,center=True, scale=True,training=is_training) x = x + layer_input x = tf.layers.batch_normalization(x, momentum=0.99, epsilon=0.001,center=True, scale=True,training=is_training) x = activation_fn(x) x = tf.nn.dropout(x, keep_prob) return x with tf.variable_scope('conv_' + str(1)): x = convolution(x, [5, 5, 5, n_channels * 2, n_channels]) x = tf.layers.batch_normalization(x, momentum=0.99, epsilon=0.001,center=True, scale=True,training=is_training) x = activation_fn(x) x = tf.nn.dropout(x, keep_prob) for i in range(1, num_convolutions): with tf.variable_scope('conv_' + str(i+1)): x = convolution(x, [5, 5, 5, n_channels, n_channels]) x = tf.layers.batch_normalization(x, momentum=0.99, epsilon=0.001,center=True, scale=True,training=is_training) # layer_input = tf.layers.batch_normalization(layer_input, momentum=0.99, epsilon=0.001,center=True, scale=True,training=is_training) if i == num_convolutions - 1: x = x + layer_input x = tf.layers.batch_normalization(x, momentum=0.99, epsilon=0.001,center=True, scale=True,training=is_training) x = activation_fn(x) x = tf.nn.dropout(x, keep_prob) return x
def convolution_block_2(layer_input, fine_grained_features, num_convolutions, keep_prob, activation_fn): x = tf.concat((layer_input, fine_grained_features), axis=-1) n_channels = get_num_channels(layer_input) if num_convolutions == 1: with tf.variable_scope('conv_' + str(1)): x = convolution(x, [5, 5, 5, n_channels * 2, n_channels]) x = x + layer_input x = activation_fn(x) x = tf.nn.dropout(x, keep_prob) return x with tf.variable_scope('conv_' + str(1)): x = convolution(x, [5, 5, 5, n_channels * 2, n_channels]) x = activation_fn(x) x = tf.nn.dropout(x, keep_prob) for i in range(1, num_convolutions): with tf.variable_scope('conv_' + str(i + 1)): x = convolution(x, [5, 5, 5, n_channels, n_channels]) if i == num_convolutions - 1: x = x + layer_input x = activation_fn(x) x = tf.nn.dropout(x, keep_prob) return x
def convolution_block(layer_input, num_convolutions, keep_prob, activation_fn): x = layer_input n_channels = get_num_channels(x) for i in range(num_convolutions): with tf.variable_scope('conv_' + str(i + 1)): x = convolution(x, [5, 5, 5, n_channels, n_channels]) if i == num_convolutions - 1: x = x + layer_input x = activation_fn(x) x = tf.nn.dropout(x, keep_prob) return x
def convolution_block(layer_input, num_convolutions, keep_prob, activation_fn, is_training): x = layer_input n_channels = get_num_channels(x) for i in range(num_convolutions): with tf.variable_scope('conv_' + str(i+1)): x = convolution(x, [5, 5, 5, n_channels, n_channels]) x = tf.layers.batch_normalization(x, momentum=0.99, epsilon=0.001,center=True, scale=True,training=is_training) # layer_input = tf.layers.batch_normalization(layer_input, momentum=0.99, epsilon=0.001,center=True, scale=True,training=is_training) if i == num_convolutions - 1: x = x + layer_input x = tf.layers.batch_normalization(x, momentum=0.99, epsilon=0.001,center=True, scale=True,training=is_training) x = activation_fn(x) x = tf.nn.dropout(x, keep_prob) return x