예제 #1
0
    def _make_se_score_feats(self, inputs, out_filters, training):
        in_filters = get_filters(inputs, self.data_format)

        inputs = batch_norm_relu(inputs, training, self.data_format)
        inputs = conv2d_fixed_padding(inputs, in_filters // 2,
                                      kernel_size=1, strides=1, data_format=self.data_format)

        inputs = batch_norm_relu(inputs, training, self.data_format)
        inputs = conv2d_fixed_padding(inputs, out_filters,
                                      kernel_size=1, strides=1, data_format=self.data_format)

        return inputs
예제 #2
0
    def _make_score_feats(self, inputs, training):
        in_filters = get_filters(inputs, self.data_format)

        inputs = batch_norm_relu(inputs, training, self.data_format)
        inputs = conv2d_fixed_padding(inputs,
                                      in_filters // 2,
                                      kernel_size=1,
                                      strides=1,
                                      data_format=self.data_format)
        inputs = batch_norm_relu(inputs, training, self.data_format)

        inputs = squeeze(inputs, self.data_format)

        inputs = tf.layers.dense(inputs, units=self.num_classes, use_bias=True)

        return tf.identity(inputs, 'final_dense')
예제 #3
0
    def _make_score_feats(self, inputs, training):
        in_filters = get_filters(inputs, self.data_format)

        inputs = batch_norm_relu(inputs, training, self.data_format)
        inputs = conv2d_fixed_padding(inputs, in_filters // 2,
                                      kernel_size=1, strides=1, data_format=self.data_format)

        inputs = batch_norm_relu(inputs, training, self.data_format)  # 1056
        inputs = conv2d_fixed_padding(inputs, 512, kernel_size=3, strides=2, data_format=self.data_format)
        inputs = batch_norm_relu(inputs, training, self.data_format)  # 512
        inputs = conv2d_fixed_padding(inputs, 128, kernel_size=1, strides=1, data_format=self.data_format)
        inputs = batch_norm_relu(inputs, training, self.data_format)
        inputs = conv2d_fixed_padding(inputs, 128, kernel_size=3, strides=1, data_format=self.data_format)
        inputs = batch_norm_relu(inputs, training, self.data_format)
        inputs = conv2d_fixed_padding(inputs, 32, kernel_size=2, strides=2, data_format=self.data_format)
        inputs = batch_norm_relu(inputs, training, self.data_format)
        inputs = tf.reshape(inputs, [-1, 2 * 2 * 32])
        fc1 = tf.add(tf.matmul(inputs, variable(128, 32)), bias([32]))
        fc1 = tf.nn.relu(fc1)
        fc3 = tf.add(tf.matmul(fc1, variable(32, 6)), bias([6]))
        # inputs = squeeze(inputs, self.data_format)
        #
        # inputs = tf.layers.dense(inputs, units=6, use_bias=True)

        return tf.identity(fc3, 'final_dense')
예제 #4
0
def get_scale(inputs, ratio, channels, training, data_format):
    inputs = batch_norm_relu(inputs, training, data_format)
    squeezed = squeeze(inputs, data_format)

    scale = tf.layers.dense(squeezed, units=channels // ratio, activation=tf.nn.relu)
    scale = tf.layers.dense(scale, units=channels, activation=tf.nn.sigmoid)

    if data_format == 'channels_first':
        scale = tf.expand_dims(scale, axis=-1)
        scale = tf.expand_dims(scale, axis=-1)
    else:
        scale = tf.expand_dims(scale, axis=1)
        scale = tf.expand_dims(scale, axis=1)

    return scale