def CAM_net2D(x, nlabels, training, scope_reuse=False): with tf.variable_scope('classifier') as scope: if scope_reuse: scope.reuse_variables() init_filters = 32 conv1_1 = layers.conv2D_layer_bn(x, 'conv1_1', num_filters=init_filters, training=training) pool1 = layers.maxpool2D_layer(conv1_1) conv2_1 = layers.conv2D_layer_bn(pool1, 'conv2_1', num_filters=init_filters*2, training=training) pool2 = layers.maxpool2D_layer(conv2_1) conv3_1 = layers.conv2D_layer_bn(pool2, 'conv3_1', num_filters=init_filters*4, training=training) conv3_2 = layers.conv2D_layer_bn(conv3_1, 'conv3_2', num_filters=init_filters*4, training=training) conv4_1 = layers.conv2D_layer_bn(conv3_2, 'conv4_1', num_filters=init_filters*8, training=training) conv4_2 = layers.conv2D_layer_bn(conv4_1, 'conv4_2', num_filters=init_filters*8, training=training) conv5_1 = layers.conv2D_layer_bn(conv4_2, 'conv5_1', num_filters=init_filters*16, training=training) conv5_2 = layers.conv2D_layer_bn(conv5_1, 'conv5_2', num_filters=init_filters*16, training=training) convD_1 = layers.conv2D_layer_bn(conv5_2, 'feature_maps', num_filters=init_filters*16, training=training) fm_averages = layers.averagepool2D_layer(convD_1, name='fm_averages') logits = layers.dense_layer(fm_averages, 'weight_layer', hidden_units=nlabels, activation=tf.identity, add_bias=False) return logits
def VGG16(x, nlabels, training, scope_reuse=False): with tf.variable_scope('classifier') as scope: if scope_reuse: scope.reuse_variables() init_filters = 64 conv1_1 = layers.conv2D_layer_bn(x, 'conv1_1', num_filters=init_filters, training=training) conv1_2 = layers.conv2D_layer_bn(conv1_1, 'conv1_2', num_filters=init_filters, training=training) pool1 = layers.maxpool2D_layer(conv1_2) conv2_1 = layers.conv2D_layer_bn(pool1, 'conv2_1', num_filters=init_filters*2, training=training) conv2_2 = layers.conv2D_layer_bn(conv2_1, 'conv2_2', num_filters=init_filters*2, training=training) pool2 = layers.maxpool2D_layer(conv2_2) conv3_1 = layers.conv2D_layer_bn(pool2, 'conv3_1', num_filters=init_filters*4, training=training) conv3_2 = layers.conv2D_layer_bn(conv3_1, 'conv3_2', num_filters=init_filters*4, training=training) conv3_3 = layers.conv2D_layer_bn(conv3_2, 'conv3_3', num_filters=init_filters*4, training=training) pool3 = layers.maxpool2D_layer(conv3_3) conv4_1 = layers.conv2D_layer_bn(pool3, 'conv4_1', num_filters=init_filters*8, training=training) conv4_2 = layers.conv2D_layer_bn(conv4_1, 'conv4_2', num_filters=init_filters*8, training=training) conv4_3 = layers.conv2D_layer_bn(conv4_2, 'conv4_3', num_filters=init_filters*8, training=training) pool4 = layers.maxpool2D_layer(conv4_3) conv5_1 = layers.conv2D_layer_bn(pool4, 'conv5_1', num_filters=init_filters*8, training=training) conv5_2 = layers.conv2D_layer_bn(conv5_1, 'conv5_2', num_filters=init_filters*8, training=training) conv5_3 = layers.conv2D_layer_bn(conv5_2, 'conv5_3', num_filters=init_filters*8, training=training) pool5 = layers.maxpool2D_layer(conv5_3) dense1 = layers.dense_layer_bn(pool5, 'dense1', hidden_units=init_filters*64, training=training) dense2 = layers.dense_layer_bn(dense1, 'dense2', hidden_units=init_filters*64, training=training) logits = layers.dense_layer_bn(dense2, 'dense3', hidden_units=nlabels, training=training, activation=tf.identity) return logits
def rebuttalnet2D(x, nlabels, training, scope_reuse=False): with tf.variable_scope('classifier') as scope: if scope_reuse: scope.reuse_variables() init_filters = 32 conv1_1 = layers.conv2D_layer_bn(x, 'conv1_1', num_filters=init_filters, training=training) pool1 = layers.maxpool2D_layer(conv1_1) conv2_1 = layers.conv2D_layer_bn(pool1, 'conv2_1', num_filters=init_filters*2, training=training) pool2 = layers.maxpool2D_layer(conv2_1) conv3_1 = layers.conv2D_layer_bn(pool2, 'conv3_1', num_filters=init_filters*4, training=training) conv3_2 = layers.conv2D_layer_bn(conv3_1, 'conv3_2', num_filters=init_filters*4, training=training) pool3 = layers.maxpool2D_layer(conv3_2) conv4_1 = layers.conv2D_layer_bn(pool3, 'conv4_1', num_filters=init_filters*8, training=training) conv4_2 = layers.conv2D_layer_bn(conv4_1, 'conv4_2', num_filters=init_filters*8, training=training) pool4 = layers.maxpool2D_layer(conv4_2) conv5_1 = layers.conv2D_layer_bn(pool4, 'conv5_1', num_filters=init_filters*16, training=training) conv5_2 = layers.conv2D_layer_bn(conv5_1, 'conv5_2', num_filters=init_filters*16, training=training) convD_1 = layers.conv2D_layer_bn(conv5_2, 'convD_1', num_filters=init_filters*16, training=training) avg_pool = layers.averagepool2D_layer(convD_1, name='avg_pool') logits = layers.dense_layer_bn(avg_pool, 'dense2', hidden_units=nlabels, training=training, activation=tf.identity) return logits
def C3D_fcn_16_2D_bn(x, training, scope_name='critic', scope_reuse=False): with tf.variable_scope(scope_name) as scope: if scope_reuse: scope.reuse_variables() conv1_1 = layers.conv2D_layer_bn(x, 'conv1_1', num_filters=16, training=training) pool1 = layers.maxpool2D_layer(conv1_1) conv2_1 = layers.conv2D_layer_bn(pool1, 'conv2_1', num_filters=32, training=training) pool2 = layers.maxpool2D_layer(conv2_1) conv3_1 = layers.conv2D_layer_bn(pool2, 'conv3_1', num_filters=64, training=training) conv3_2 = layers.conv2D_layer_bn(conv3_1, 'conv3_2', num_filters=64, training=training) pool3 = layers.maxpool2D_layer(conv3_2) conv4_1 = layers.conv2D_layer_bn(pool3, 'conv4_1', num_filters=128, training=training) conv4_2 = layers.conv2D_layer_bn(conv4_1, 'conv4_2', num_filters=128,training=training) pool4 = layers.maxpool2D_layer(conv4_2) conv5_1 = layers.conv2D_layer_bn(pool4, 'conv5_1', num_filters=256, training=training) conv5_2 = layers.conv2D_layer_bn(conv5_1, 'conv5_2', num_filters=256, training=training) convD_1 = layers.conv2D_layer_bn(conv5_2, 'convD_1', num_filters=256, training=training) convD_2 = layers.conv2D_layer(convD_1, 'convD_2', num_filters=1, kernel_size=(1,1,1), activation=tf.identity) logits = layers.averagepool2D_layer(convD_2, name='diagnosis_avg') return logits
def unet_16_2D_bn(x, training, scope_name='generator'): n_ch_0 = 16 with tf.variable_scope(scope_name): conv1_1 = layers.conv2D_layer_bn(x, 'conv1_1', num_filters=n_ch_0, training=training) conv1_2 = layers.conv2D_layer_bn(conv1_1, 'conv1_2', num_filters=n_ch_0, training=training) pool1 = layers.maxpool2D_layer(conv1_2) conv2_1 = layers.conv2D_layer_bn(pool1, 'conv2_1', num_filters=n_ch_0 * 2, training=training) conv2_2 = layers.conv2D_layer_bn(conv2_1, 'conv2_2', num_filters=n_ch_0 * 2, training=training) pool2 = layers.maxpool2D_layer(conv2_2) conv3_1 = layers.conv2D_layer_bn(pool2, 'conv3_1', num_filters=n_ch_0 * 4, training=training) conv3_2 = layers.conv2D_layer_bn(conv3_1, 'conv3_2', num_filters=n_ch_0 * 4, training=training) pool3 = layers.maxpool2D_layer(conv3_2) conv4_1 = layers.conv2D_layer_bn(pool3, 'conv4_1', num_filters=n_ch_0 * 8, training=training) conv4_2 = layers.conv2D_layer_bn(conv4_1, 'conv4_2', num_filters=n_ch_0 * 8, training=training) upconv3 = layers.deconv2D_layer_bn(conv4_2, name='upconv3', num_filters=n_ch_0, training=training) concat3 = layers.crop_and_concat_layer([upconv3, conv3_2], axis=-1) conv5_1 = layers.conv2D_layer_bn(concat3, 'conv5_1', num_filters=n_ch_0 * 4, training=training) conv5_2 = layers.conv2D_layer_bn(conv5_1, 'conv5_2', num_filters=n_ch_0 * 4, training=training) upconv2 = layers.deconv2D_layer_bn(conv5_2, name='upconv2', num_filters=n_ch_0, training=training) concat2 = layers.crop_and_concat_layer([upconv2, conv2_2], axis=-1) conv6_1 = layers.conv2D_layer_bn(concat2, 'conv6_1', num_filters=n_ch_0 * 2, training=training) conv6_2 = layers.conv2D_layer_bn(conv6_1, 'conv6_2', num_filters=n_ch_0 * 2, training=training) upconv1 = layers.deconv2D_layer_bn(conv6_2, name='upconv1', num_filters=n_ch_0, training=training) concat1 = layers.crop_and_concat_layer([upconv1, conv1_2], axis=-1) conv8_1 = layers.conv2D_layer_bn(concat1, 'conv8_1', num_filters=n_ch_0, training=training) conv8_2 = layers.conv2D_layer(conv8_1, 'conv8_2', num_filters=1, activation=tf.identity) return conv8_2