Skip to content

Instantly share code, notes, and snippets.

@dongzhuoyao
Created December 25, 2016 05:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dongzhuoyao/f3643b581154e8d6f26bde092e8363ad to your computer and use it in GitHub Desktop.
Save dongzhuoyao/f3643b581154e8d6f26bde092e8363ad to your computer and use it in GitHub Desktop.
deeplabv2_vgg16_train
# VGG 16-layer network convolutional finetuning
# Network modified to have smaller receptive field (128 pixels)
# nand smaller stride (8 pixels) when run in convolutional mode.
#
# In this model we also change max pooling size in the first 4 layers
# from 2 to 3 while retaining stride = 2
# which makes it easier to exactly align responses at different layers.
#
# For alignment to work, we set (we choose 32x so as to be able to evaluate
# the model for all different subsampling sizes):
# (1) input dimension equal to
# $n = 32 * k - 31$, e.g., 321 (for k = 11)
# Dimension after pooling w. subsampling:
# (16 * k - 15); (8 * k - 7); (4 * k - 3); (2 * k - 1); (k).
# For k = 11, these translate to
# 161; 81; 41; 21; 11
#
name: "deeplabv2_vgg16_train"
layer {
name: "data"
type: "ImageSegData"
top: "data"
top: "label"
top: "data_dim"
include {
phase: TRAIN
}
transform_param {
mirror: true
crop_size: 321
mean_value: 104.008
mean_value: 116.669
mean_value: 122.675
}
image_data_param {
root_folder: ""
source: "camvid/list/train.txt"
batch_size: 10
shuffle: true
label_type: PIXEL
}
}
###################### DeepLab ####################
layer {
name: "conv1_1"
type: "Convolution"
bottom: "data"
top: "conv1_1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 64
pad: 1
kernel_size: 3
}
}
layer {
name: "relu1_1"
type: "ReLU"
bottom: "conv1_1"
top: "conv1_1"
}
layer {
name: "conv1_2"
type: "Convolution"
bottom: "conv1_1"
top: "conv1_2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 64
pad: 1
kernel_size: 3
}
}
layer {
name: "relu1_2"
type: "ReLU"
bottom: "conv1_2"
top: "conv1_2"
}
layer {
name: "pool1"
type: "Pooling"
bottom: "conv1_2"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
pad: 1
}
}
layer {
name: "conv2_1"
type: "Convolution"
bottom: "pool1"
top: "conv2_1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 128
pad: 1
kernel_size: 3
}
}
layer {
name: "relu2_1"
type: "ReLU"
bottom: "conv2_1"
top: "conv2_1"
}
layer {
name: "conv2_2"
type: "Convolution"
bottom: "conv2_1"
top: "conv2_2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 128
pad: 1
kernel_size: 3
}
}
layer {
name: "relu2_2"
type: "ReLU"
bottom: "conv2_2"
top: "conv2_2"
}
layer {
name: "pool2"
type: "Pooling"
bottom: "conv2_2"
top: "pool2"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
pad: 1
}
}
layer {
name: "conv3_1"
type: "Convolution"
bottom: "pool2"
top: "conv3_1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
}
}
layer {
name: "relu3_1"
type: "ReLU"
bottom: "conv3_1"
top: "conv3_1"
}
layer {
name: "conv3_2"
type: "Convolution"
bottom: "conv3_1"
top: "conv3_2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
}
}
layer {
name: "relu3_2"
type: "ReLU"
bottom: "conv3_2"
top: "conv3_2"
}
layer {
name: "conv3_3"
type: "Convolution"
bottom: "conv3_2"
top: "conv3_3"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
}
}
layer {
name: "relu3_3"
type: "ReLU"
bottom: "conv3_3"
top: "conv3_3"
}
layer {
name: "pool3"
type: "Pooling"
bottom: "conv3_3"
top: "pool3"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
pad: 1
}
}
layer {
name: "conv4_1"
type: "Convolution"
bottom: "pool3"
top: "conv4_1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 512
pad: 1
kernel_size: 3
}
}
layer {
name: "relu4_1"
type: "ReLU"
bottom: "conv4_1"
top: "conv4_1"
}
layer {
name: "conv4_2"
type: "Convolution"
bottom: "conv4_1"
top: "conv4_2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 512
pad: 1
kernel_size: 3
}
}
layer {
name: "relu4_2"
type: "ReLU"
bottom: "conv4_2"
top: "conv4_2"
}
layer {
name: "conv4_3"
type: "Convolution"
bottom: "conv4_2"
top: "conv4_3"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 512
pad: 1
kernel_size: 3
}
}
layer {
name: "relu4_3"
type: "ReLU"
bottom: "conv4_3"
top: "conv4_3"
}
layer {
bottom: "conv4_3"
top: "pool4"
name: "pool4"
type: "Pooling"
pooling_param {
pool: MAX
kernel_size: 3
pad: 1
stride: 1
}
}
layer {
name: "conv5_1"
type: "Convolution"
bottom: "pool4"
top: "conv5_1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 512
pad: 2
kernel_size: 3
dilation: 2
}
}
layer {
name: "relu5_1"
type: "ReLU"
bottom: "conv5_1"
top: "conv5_1"
}
layer {
name: "conv5_2"
type: "Convolution"
bottom: "conv5_1"
top: "conv5_2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 512
pad: 2
kernel_size: 3
dilation: 2
}
}
layer {
name: "relu5_2"
type: "ReLU"
bottom: "conv5_2"
top: "conv5_2"
}
layer {
name: "conv5_3"
type: "Convolution"
bottom: "conv5_2"
top: "conv5_3"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 512
pad: 2
kernel_size: 3
dilation: 2
}
}
layer {
name: "relu5_3"
type: "ReLU"
bottom: "conv5_3"
top: "conv5_3"
}
layer {
bottom: "conv5_3"
top: "pool5"
name: "pool5"
type: "Pooling"
pooling_param {
pool: MAX
kernel_size: 3
stride: 1
pad: 1
}
}
### hole = 6
layer {
name: "fc6_1"
type: "Convolution"
bottom: "pool5"
top: "fc6_1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 1024
pad: 6
kernel_size: 3
dilation: 6
}
}
layer {
name: "relu6_1"
type: "ReLU"
bottom: "fc6_1"
top: "fc6_1"
}
layer {
name: "drop6_1"
type: "Dropout"
bottom: "fc6_1"
top: "fc6_1"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc7_1"
type: "Convolution"
bottom: "fc6_1"
top: "fc7_1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 1024
kernel_size: 1
}
}
layer {
name: "relu7_1"
type: "ReLU"
bottom: "fc7_1"
top: "fc7_1"
}
layer {
name: "drop7_1"
type: "Dropout"
bottom: "fc7_1"
top: "fc7_1"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc8_camvid_1"
type: "Convolution"
bottom: "fc7_1"
top: "fc8_camvid_1"
param {
lr_mult: 10
decay_mult: 1
}
param {
lr_mult: 20
decay_mult: 0
}
convolution_param {
num_output: 12
kernel_size: 1
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
}
### hole = 12
layer {
name: "fc6_2"
type: "Convolution"
bottom: "pool5"
top: "fc6_2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 1024
pad: 12
kernel_size: 3
dilation: 12
}
}
layer {
name: "relu6_2"
type: "ReLU"
bottom: "fc6_2"
top: "fc6_2"
}
layer {
name: "drop6_2"
type: "Dropout"
bottom: "fc6_2"
top: "fc6_2"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc7_2"
type: "Convolution"
bottom: "fc6_2"
top: "fc7_2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 1024
kernel_size: 1
}
}
layer {
name: "relu7_2"
type: "ReLU"
bottom: "fc7_2"
top: "fc7_2"
}
layer {
name: "drop7_2"
type: "Dropout"
bottom: "fc7_2"
top: "fc7_2"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc8_camvid_2"
type: "Convolution"
bottom: "fc7_2"
top: "fc8_camvid_2"
param {
lr_mult: 10
decay_mult: 1
}
param {
lr_mult: 20
decay_mult: 0
}
convolution_param {
num_output: 12
kernel_size: 1
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
}
### hole = 18
layer {
name: "fc6_3"
type: "Convolution"
bottom: "pool5"
top: "fc6_3"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 1024
pad: 18
kernel_size: 3
dilation: 18
}
}
layer {
name: "relu6_3"
type: "ReLU"
bottom: "fc6_3"
top: "fc6_3"
}
layer {
name: "drop6_3"
type: "Dropout"
bottom: "fc6_3"
top: "fc6_3"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc7_3"
type: "Convolution"
bottom: "fc6_3"
top: "fc7_3"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 1024
kernel_size: 1
}
}
layer {
name: "relu7_3"
type: "ReLU"
bottom: "fc7_3"
top: "fc7_3"
}
layer {
name: "drop7_3"
type: "Dropout"
bottom: "fc7_3"
top: "fc7_3"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc8_camvid_3"
type: "Convolution"
bottom: "fc7_3"
top: "fc8_camvid_3"
param {
lr_mult: 10
decay_mult: 1
}
param {
lr_mult: 20
decay_mult: 0
}
convolution_param {
num_output: 12
kernel_size: 1
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
}
### hole = 24
layer {
name: "fc6_4"
type: "Convolution"
bottom: "pool5"
top: "fc6_4"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 1024
pad: 24
kernel_size: 3
dilation: 24
}
}
layer {
name: "relu6_4"
type: "ReLU"
bottom: "fc6_4"
top: "fc6_4"
}
layer {
name: "drop6_4"
type: "Dropout"
bottom: "fc6_4"
top: "fc6_4"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc7_4"
type: "Convolution"
bottom: "fc6_4"
top: "fc7_4"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 1024
kernel_size: 1
}
}
layer {
name: "relu7_4"
type: "ReLU"
bottom: "fc7_4"
top: "fc7_4"
}
layer {
name: "drop7_4"
type: "Dropout"
bottom: "fc7_4"
top: "fc7_4"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc8_camvid_4"
type: "Convolution"
bottom: "fc7_4"
top: "fc8_camvid_4"
param {
lr_mult: 10
decay_mult: 1
}
param {
lr_mult: 20
decay_mult: 0
}
convolution_param {
num_output: 12
kernel_size: 1
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
}
### SUM the four branches
layer {
bottom: "fc8_camvid_1"
bottom: "fc8_camvid_2"
bottom: "fc8_camvid_3"
bottom: "fc8_camvid_4"
top: "fc8_camvid"
name: "fc8_camvid"
type: "Eltwise"
eltwise_param {
operation: SUM
}
}
#################
layer {
bottom: "label"
top: "label_shrink"
name: "label_shrink"
type: "Interp"
interp_param {
shrink_factor: 8
pad_beg: 0
pad_end: 0
}
}
layer {
name: "loss"
type: "SoftmaxWithLoss"
bottom: "fc8_camvid"
bottom: "label_shrink"
include {
phase: TRAIN
}
loss_param {
ignore_label: 255
}
}
layer {
name: "accuracy"
type: "SegAccuracy"
bottom: "fc8_camvid"
bottom: "label_shrink"
top: "accuracy"
seg_accuracy_param {
ignore_label: 255
}
}
layer {
name: "silence"
type: "Silence"
bottom: "data_dim"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment