# VGG 16-layer network convolutional finetuning # Network modified to have smaller receptive field (128 pixels) # and smaller stride (8 pixels) when run in convolutional mode. # # In this model we also change max pooling size in the first 4 layer # from 2 to 3 while retaining stride = 2 # which makes it easier to exactly align responses at different layer. # name: "deeplab_msc_largeFOV" layer { name: "data" type: "ImageSegData" top: "data" top: "label" top: "data_dim" image_data_param { root_folder: "/home/m62tang/rloss/data/pascal_scribble/" source: "pascal_scribble/list/val.txt" label_type: PIXEL batch_size: 1 } transform_param { mean_value: 104.008 mean_value: 116.669 mean_value: 122.675 crop_size: 513 mirror: false } include: { phase: TEST } } # BEG (0) Direct path to classifier layer { bottom: "data" top: "data_conv" name: "data_conv" type: "Convolution" convolution_param { num_output: 128 kernel_size: 3 stride: 1 pad: 1 } } layer { bottom: "data_conv" top: "data_conv" name: "relu_data_conv" type: "ReLU" } layer { bottom: "data_conv" top: "data_conv" name: "drop_data_conv" type: "Dropout" dropout_param { dropout_ratio: 0.5 } } layer { bottom: "data_conv" top: "data_fc" name: "data_fc" type: "Convolution" convolution_param { num_output: 128 kernel_size: 1 stride: 1 } } layer { bottom: "data_fc" top: "data_fc" name: "relu_data_fc" type: "ReLU" } layer { bottom: "data_fc" top: "data_fc" name: "drop_data_fc" type: "Dropout" dropout_param { dropout_ratio: 0.5 } } layer { bottom: "data_fc" top: "data_ms" name: "data_ms" type: "Convolution" convolution_param { num_output: 21 kernel_size: 1 } } # END (0) Direct path to classifier ### NETWORK ### layer { bottom: "data" top: "conv1_1" name: "conv1_1" type: "Convolution" convolution_param { num_output: 64 pad: 1 kernel_size: 3 } } layer { bottom: "conv1_1" top: "conv1_1" name: "relu1_1" type: "ReLU" } layer { bottom: "conv1_1" top: "conv1_2" name: "conv1_2" type: "Convolution" convolution_param { num_output: 64 pad: 1 kernel_size: 3 } } layer { bottom: "conv1_2" top: "conv1_2" name: "relu1_2" type: "ReLU" } layer { bottom: "conv1_2" top: "pool1" name: "pool1" type: "Pooling" pooling_param { pool: MAX kernel_size: 3 stride: 2 pad: 1 } } # BEG (1) Direct path to classifier layer { bottom: "pool1" top: "pool1_conv" name: "pool1_conv" type: "Convolution" convolution_param { num_output: 128 kernel_size: 3 stride:1 pad: 1 } } layer { bottom: "pool1_conv" top: "pool1_conv" name: "relu_pool1_conv" type: "ReLU" } layer { bottom: "pool1_conv" top: "pool1_conv" name: "drop_pool1_conv" type: "Dropout" dropout_param { dropout_ratio: 0.5 } } layer { bottom: "pool1_conv" top: "pool1_fc" name: "pool1_fc" type: "Convolution" convolution_param { num_output: 128 kernel_size: 1 } } layer { bottom: "pool1_fc" top: "pool1_fc" name: "relu_pool1_fc" type: "ReLU" } layer { bottom: "pool1_fc" top: "pool1_fc" name: "drop_pool1_fc" type: "Dropout" dropout_param { dropout_ratio: 0.5 } } layer { bottom: "pool1_fc" top: "pool1_ms" name: "pool1_ms" type: "Convolution" convolution_param { num_output: 21 kernel_size: 1 } } # END (1) Direct path to classifier layer { bottom: "pool1" top: "conv2_1" name: "conv2_1" type: "Convolution" convolution_param { num_output: 128 pad: 1 kernel_size: 3 } } layer { bottom: "conv2_1" top: "conv2_1" name: "relu2_1" type: "ReLU" } layer { bottom: "conv2_1" top: "conv2_2" name: "conv2_2" type: "Convolution" convolution_param { num_output: 128 pad: 1 kernel_size: 3 } } layer { bottom: "conv2_2" top: "conv2_2" name: "relu2_2" type: "ReLU" } layer { bottom: "conv2_2" top: "pool2" name: "pool2" type: "Pooling" pooling_param { pool: MAX kernel_size: 3 stride: 2 pad: 1 } } # BEG (2) Direct path to classifier layer { bottom: "pool2" top: "pool2_conv" name: "pool2_conv" type: "Convolution" convolution_param { num_output: 128 kernel_size: 3 stride: 1 pad: 1 } } layer { bottom: "pool2_conv" top: "pool2_conv" name: "relu_pool2_conv" type: "ReLU" } layer { bottom: "pool2_conv" top: "pool2_conv" name: "drop_pool2_conv" type: "Dropout" dropout_param { dropout_ratio: 0.5 } } layer { bottom: "pool2_conv" top: "pool2_fc" name: "pool2_fc" type: "Convolution" convolution_param { num_output: 128 kernel_size: 1 } } layer { bottom: "pool2_fc" top: "pool2_fc" name: "relu_pool2_fc" type: "ReLU" } layer { bottom: "pool2_fc" top: "pool2_fc" name: "drop_pool2_fc" type: "Dropout" dropout_param { dropout_ratio: 0.5 } } layer { bottom: "pool2_fc" top: "pool2_ms" name: "pool2_ms" type: "Convolution" convolution_param { num_output: 21 kernel_size: 1 } } # END (2) Direct path to classifier layer { bottom: "pool2" top: "conv3_1" name: "conv3_1" type: "Convolution" convolution_param { num_output: 256 pad: 1 kernel_size: 3 } } layer { bottom: "conv3_1" top: "conv3_1" name: "relu3_1" type: "ReLU" } layer { bottom: "conv3_1" top: "conv3_2" name: "conv3_2" type: "Convolution" convolution_param { num_output: 256 pad: 1 kernel_size: 3 } } layer { bottom: "conv3_2" top: "conv3_2" name: "relu3_2" type: "ReLU" } layer { bottom: "conv3_2" top: "conv3_3" name: "conv3_3" type: "Convolution" convolution_param { num_output: 256 pad: 1 kernel_size: 3 } } layer { bottom: "conv3_3" top: "conv3_3" name: "relu3_3" type: "ReLU" } layer { bottom: "conv3_3" top: "pool3" name: "pool3" type: "Pooling" pooling_param { pool: MAX kernel_size: 3 stride: 2 pad: 1 } } # BEG (3) Direct path to classifier layer { bottom: "pool3" top: "pool3_conv" name: "pool3_conv" type: "Convolution" convolution_param { num_output: 128 kernel_size: 3 stride: 1 pad: 1 } } layer { bottom: "pool3_conv" top: "pool3_conv" name: "relu_pool3_conv" type: "ReLU" } layer { bottom: "pool3_conv" top: "pool3_conv" name: "drop_pool3_conv" type: "Dropout" dropout_param { dropout_ratio: 0.5 } } layer { bottom: "pool3_conv" top: "pool3_fc" name: "pool3_fc" type: "Convolution" convolution_param { num_output: 128 kernel_size: 1 stride: 1 } } layer { bottom: "pool3_fc" top: "pool3_fc" name: "relu_pool3_fc" type: "ReLU" } layer { bottom: "pool3_fc" top: "pool3_fc" name: "drop_pool3_fc" type: "Dropout" dropout_param { dropout_ratio: 0.5 } } layer { bottom: "pool3_fc" top: "pool3_ms" name: "pool3_ms" type: "Convolution" convolution_param { num_output: 21 kernel_size: 1 } } # END (3) Direct path to classifier layer { bottom: "pool3" top: "conv4_1" name: "conv4_1" type: "Convolution" convolution_param { num_output: 512 pad: 1 kernel_size: 3 } } layer { bottom: "conv4_1" top: "conv4_1" name: "relu4_1" type: "ReLU" } layer { bottom: "conv4_1" top: "conv4_2" name: "conv4_2" type: "Convolution" convolution_param { num_output: 512 pad: 1 kernel_size: 3 } } layer { bottom: "conv4_2" top: "conv4_2" name: "relu4_2" type: "ReLU" } layer { bottom: "conv4_2" top: "conv4_3" name: "conv4_3" type: "Convolution" convolution_param { num_output: 512 pad: 1 kernel_size: 3 } } layer { bottom: "conv4_3" top: "conv4_3" name: "relu4_3" type: "ReLU" } layer { bottom: "conv4_3" top: "pool4" name: "pool4" type: "Pooling" pooling_param { pool: MAX kernel_size: 3 pad: 1 #stride: 2 stride: 1 } } # BEG (4) Direct path to classifier layer { bottom: "pool4" top: "pool4_conv" name: "pool4_conv" type: "Convolution" convolution_param { num_output: 128 kernel_size: 3 stride: 1 pad: 1 } } layer { bottom: "pool4_conv" top: "pool4_conv" name: "relu_pool4_conv" type: "ReLU" } layer { bottom: "pool4_conv" top: "pool4_conv" name: "drop_pool4_conv" type: "Dropout" dropout_param { dropout_ratio: 0.5 } } layer { bottom: "pool4_conv" top: "pool4_fc" name: "pool4_fc" type: "Convolution" convolution_param { num_output: 128 kernel_size: 1 stride: 1 weight_filler { type: "gaussian" std: 0.005 } bias_filler { type: "constant" value: 0 } } } layer { bottom: "pool4_fc" top: "pool4_fc" name: "relu_pool4_fc" type: "ReLU" } layer { bottom: "pool4_fc" top: "pool4_fc" name: "drop_pool4_fc" type: "Dropout" dropout_param { dropout_ratio: 0.5 } } layer { bottom: "pool4_fc" top: "pool4_ms" name: "pool4_ms" type: "Convolution" convolution_param { num_output: 21 kernel_size: 1 } } # END (4) Direct path to classifier layer { bottom: "pool4" top: "conv5_1" name: "conv5_1" type: "Convolution" convolution_param { num_output: 512 #pad: 1 pad: 2 dilation: 2 kernel_size: 3 } } layer { bottom: "conv5_1" top: "conv5_1" name: "relu5_1" type: "ReLU" } layer { bottom: "conv5_1" top: "conv5_2" name: "conv5_2" type: "Convolution" convolution_param { num_output: 512 #pad: 1 pad: 2 dilation: 2 kernel_size: 3 } } layer { bottom: "conv5_2" top: "conv5_2" name: "relu5_2" type: "ReLU" } layer { bottom: "conv5_2" top: "conv5_3" name: "conv5_3" type: "Convolution" convolution_param { num_output: 512 #pad: 1 pad: 2 dilation: 2 kernel_size: 3 } } layer { bottom: "conv5_3" top: "conv5_3" name: "relu5_3" type: "ReLU" } layer { bottom: "conv5_3" top: "pool5" name: "pool5" type: "Pooling" pooling_param { pool: MAX #kernel_size: 2 #stride: 2 kernel_size: 3 stride: 1 pad: 1 } } layer { bottom: "pool5" top: "pool5a" name: "pool5a" type: "Pooling" pooling_param { pool: AVE kernel_size: 3 stride: 1 pad: 1 } } layer { bottom: "pool5a" top: "fc6" name: "fc6" type: "Convolution" #strict_dim: false convolution_param { num_output: 1024 pad: 12 dilation: 12 kernel_size: 3 } } layer { bottom: "fc6" top: "fc6" name: "relu6" type: "ReLU" } layer { bottom: "fc6" top: "fc6" name: "drop6" type: "Dropout" dropout_param { dropout_ratio: 0.5 } } layer { bottom: "fc6" top: "fc7" name: "fc7" type: "Convolution" #strict_dim: false convolution_param { num_output: 1024 kernel_size: 1 } } layer { bottom: "fc7" top: "fc7" name: "relu7" type: "ReLU" } layer { bottom: "fc7" top: "fc7" name: "drop7" type: "Dropout" dropout_param { dropout_ratio: 0.5 } } layer { bottom: "fc7" top: "fc8_pascal_scribble" name: "fc8_pascal_scribble" type: "Convolution" #strict_dim: false convolution_param { num_output: 21 kernel_size: 1 } } # Upsampling and fusion layer { bottom: "pool1_ms" top: "pool1_interp" name: "pool1_interp" type: "Interp" interp_param { zoom_factor: 2 } } layer { bottom: "pool2_ms" top: "pool2_interp" name: "pool2_interp" type: "Interp" interp_param { zoom_factor: 4 } } layer { bottom: "pool3_ms" top: "pool3_interp" name: "pool3_interp" type: "Interp" interp_param { zoom_factor: 8 } } layer { bottom: "pool4_ms" top: "pool4_interp" name: "pool4_interp" type: "Interp" interp_param { zoom_factor: 8 } } layer { bottom: "fc8_pascal_scribble" top: "fc8_interp" name: "fc8_interp" type: "Interp" interp_param { zoom_factor: 8 } } # Fusion layer layer { bottom: "data_ms" bottom: "pool1_interp" bottom: "pool2_interp" bottom: "pool3_interp" bottom: "pool4_interp" bottom: "fc8_interp" top: "fc_fusion" name: "fc_fusion" type: "Eltwise" eltwise_param { operation: SUM } } # JAY EDIT THIS LAYER #layer { # bottom: "fc8_interp" # bottom: "data_dim" # bottom: "data" # top: "crf_inf" # name: "crf" # type: DENSE_CRF # dense_crf_param { # max_iter: 10 # pos_w: 3 # pos_xy_std: 3 # bi_w: 5 # bi_xy_std: 50 # bi_rgb_std: 10 # } # include: { phase: TEST } #} #layer { # name: "crf_mat" # type: MAT_WRITE # bottom: "crf_inf" # mat_write_param { # prefix: "pascal_scribble/features/deeplab_msc_largeFOV/val/crf/" # source: "pascal_scribble/list/val_id.txt" # strip: 0 # period: 1 # } # include: { phase: TEST } #} # layer { # bottom: "label" # name: "silence" # type: SILENCE # include: { phase: TEST } # } layer { name: "accuracy" type: "SegAccuracy" bottom: "fc_fusion" bottom: "label" top: "accuracy" seg_accuracy_param { ignore_label: 255 reset: false } } ########### DENSE CRF ############ #layer { # bottom: "fc_fusion" # bottom: "data_dim" # bottom: "data" # top: "crf_inf" # name: "crf" # type: "DenseCRF" # dense_crf_param { # max_iter: 10 # pos_w: 3 # pos_xy_std: 3 # bi_w: 4 # bi_xy_std: 83 # bi_rgb_std: 5 # } #} #layer { # name: "accuracyCRF" # type: "SegAccuracy" # bottom: "crf_inf" # bottom: "label" # top: "accuracyCRF" # seg_accuracy_param { # ignore_label: 255 # reset: false # } #} #layer { # name: "crf_mat" # type: "MatWrite" # bottom: "crf_inf" # include { # phase: TEST # } # mat_write_param { # prefix: "pascal_scribble/features/deeplab_msc_largeFOV/val/crf/" # source: "pascal_scribble/list/val_id.txt" # strip: 0 # period: 1 # } #}