

name: "QuShadowRemovNet"
input: "data"
input_dim: 1
input_dim: 3
input_dim: 224
input_dim: 224
layer {
  bottom: "data"
  top: "conv1_1"
  name: "conv1_1"
  type: "Convolution"
  param {
    lr_mult:0
    decay_mult: 0
    name: "conv1_1w"
  }
  param {
    lr_mult: 0
    decay_mult: 0
    name: "conv1_1b"
  }
  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"
  param {
    lr_mult:0
    decay_mult: 0
    name: "conv1_2w"
  }
  param {
    lr_mult: 0
    decay_mult: 0
    name: "conv1_2b"
  }
  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: 2
    stride: 2
  }
}
layer {
  bottom: "pool1"
  top: "conv2_1"
  name: "conv2_1"
  type: "Convolution"
  param {
    lr_mult:0
    decay_mult: 0
    name: "conv2_1w"
  }
  param {
    lr_mult: 0
    decay_mult: 0
    name: "conv2_1b"
  }
  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"
  param {
    lr_mult:0
    decay_mult: 0
    name: "conv2_2w"
  }
  param {
    lr_mult: 0
    decay_mult: 0
    name: "conv2_2b"
  }
  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: 2
    stride: 2
  }
}
layer {
  bottom: "pool2"
  top: "conv3_1"
  name: "conv3_1"
  type: "Convolution"
  param {
    lr_mult:0
    decay_mult: 0
    name: "conv3_1w"
  }
  param {
    lr_mult: 0
    decay_mult: 0
    name: "conv3_1b"
  }
  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"
  param {
    lr_mult:0
    decay_mult: 0
    name: "conv3_3w"
  }
  param {
    lr_mult: 0
    decay_mult: 0
    name: "conv3_3b"
  }
  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: 2
    stride: 2
  }
}
layer {
  bottom: "pool3"
  top: "conv4_1"
  name: "conv4_1"
  type: "Convolution"
 param {
    lr_mult:0
    decay_mult: 0
    name: "conv4_1w"
  }
  param {
    lr_mult: 0
    decay_mult: 0
    name: "conv4_1b"
  }
  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"
  param {
    lr_mult:0
    decay_mult: 0
    name: "conv4_2w"
  }
  param {
    lr_mult: 0
    decay_mult: 0
    name: "conv4_2b"
  }
  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"
  param {
    lr_mult:0
    decay_mult: 0
    name: "conv4_3w"
  }
  param {
    lr_mult: 0
    decay_mult: 0
    name: "conv4_3b"
  }
  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: 2
    stride: 1
    pad: 1
  }
}
layer {
  bottom: "pool4"
  top: "conv5_1"
  name: "conv5_1"
  type: "Convolution"
 param {
    lr_mult:0
    decay_mult: 0
    name: "conv5_1w"
  }
  param {
    lr_mult: 0
    decay_mult: 0
    name: "conv5_1b"
  }
  convolution_param {
    num_output: 512
    pad: 1
    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"
  param {
    lr_mult:0
    decay_mult: 0
    name: "conv5_2w"
  }
  param {
    lr_mult: 0
    decay_mult: 0
    name: "conv5_2b"
  }
  type: "Convolution"
  convolution_param {
    num_output: 512
    pad: 1
    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"
 param {
    lr_mult:0
    decay_mult: 0
    name: "conv5_3w"
  }
  param {
    lr_mult: 0
    decay_mult: 0
    name: "conv5_3b"
  }
  convolution_param {
    num_output: 512
    pad: 1
    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: 1
  }
}


# Upsampling hypercolumns




layer {
  name: "conv3-upsample", type: "Deconvolution"
  bottom: "pool3" top: "conv3-upsample"
  convolution_param {
    kernel_size: 4  stride: 2
    num_output: 256 group: 256
    pad: 1
    weight_filler: { type: "bilinear" } bias_term: false
  }
  param { lr_mult: 2 decay_mult: 0 }
}

layer {
  name: "conv5-upsample", type: "Deconvolution"
  bottom: "pool5" top: "conv5-upsample"
  convolution_param {
    kernel_size: 8 stride: 4
    num_output: 256 group: 256
    pad: 2
    weight_filler: { type: "bilinear" } bias_term: false
  }
  param { lr_mult: 0 decay_mult: 0 }
}


# Concatinating different scales

# Transform into `num_out` dim


layer {
  name: "s3-1-out"
  type: "Convolution"
  bottom: "conv3-upsample"
  top: "s3-1-out"
  param {
    lr_mult: 5
    decay_mult: 1
    
  }
  param {
    lr_mult: 5
    decay_mult: 0
    
  }
  convolution_param {
    num_output: 64
    kernel_size: 1
    stride: 1
    
    pad: 0
    weight_filler {
      std: 0.01
      type: "gaussian"
      
    }
    bias_filler {
      type: "constant"
      value: 0
      
    }
  }
}

layer {
  name: "s3-1-out-nonlin"
  type: "PReLU"
  bottom: "s3-1-out"
  top: "s3-1-out"
  
  param {
    decay_mult: 0
    lr_mult: 5
    
  }
  
}


layer {
  name: "s3-1-out-drop"
  type: "Dropout"
  bottom: "s3-1-out"
  top: "s3-1-out"
  dropout_param {
    dropout_ratio: 0.5
  }
}


layer {
  name: "s3-2-1"
  type: "Convolution"
  bottom: "data"
  top: "s3-2-1"
  param {
    lr_mult: 5
    decay_mult: 1
    
  }
  param {
    lr_mult: 5
    decay_mult: 0
    
  }
  convolution_param {
    num_output: 96
    kernel_size: 9
    stride: 2
    
    pad: 4
    weight_filler {
      std: 0.001
      type: "gaussian"
      
    }
    bias_filler {
      type: "constant"
      value: 0
      
    }
  }
}

layer {
  name: "s3-2-1-nonlin"
  type: "PReLU"
  bottom: "s3-2-1"
  top: "s3-2-1"
  
  param {
    decay_mult: 0
    lr_mult: 5
    
  }
  
}


layer {
  name: "s3-2-1-pool"
  type: "Pooling"
  bottom: "s3-2-1"
  top: "s3-2-1-pool"
  pooling_param {
    pool: MAX
    kernel_size: 3
    stride: 2
  }
}




layer {
  name: "s3-2-concat"
  type: "Concat"
  bottom: "s3-2-1-pool" bottom: "s3-1-out" top: "s3-2-concat"
}

layer {
  name: "s3-2-2"
  type: "Convolution"
  bottom: "s3-2-concat"
  top: "s3-2-2"
  param {
    lr_mult: 5
    decay_mult: 1
    
  }
  param {
    lr_mult: 5
    decay_mult: 0
    
  }
  convolution_param {
    num_output: 64
    kernel_size: 5
    stride: 1
    
    pad: 2
    weight_filler {
      std: 0.01
      type: "gaussian"
      
    }
    bias_filler {
      type: "constant"
      value: 0
      
    }
  }
}

layer {
  name: "s3-2-2-nonlin"
  type: "PReLU"
  bottom: "s3-2-2"
  top: "s3-2-2"
  
  param {
    decay_mult: 0
    lr_mult: 5
    
  }
  
}


layer {
  name: "s3-2-2-drop"
  type: "Dropout"
  bottom: "s3-2-2"
  top: "s3-2-2"
  dropout_param {
    dropout_ratio: 0.5
  }
}


layer {
  name: "s3-2-3"
  type: "Convolution"
  bottom: "s3-2-2"
  top: "s3-2-3"
  param {
    lr_mult: 5
    decay_mult: 1
    
  }
  param {
    lr_mult: 5
    decay_mult: 0
    
  }
  convolution_param {
    num_output: 64
    kernel_size: 5
    stride: 1
    
    pad: 2
    weight_filler {
      std: 0.01
      type: "gaussian"
      
    }
    bias_filler {
      type: "constant"
      value: 0
      
    }
  }
}

layer {
  name: "s3-2-3-nonlin"
  type: "PReLU"
  bottom: "s3-2-3"
  top: "s3-2-3"
  
  param {
    decay_mult: 0
    lr_mult: 5
    
  }
  
}


layer {
  name: "s3-2-3-drop"
  type: "Dropout"
  bottom: "s3-2-3"
  top: "s3-2-3"
  dropout_param {
    dropout_ratio: 0.5
  }
}

layer {
  name: "s3-2-4"
  type: "Convolution"
  bottom: "s3-2-3"
  top: "s3-2-4"
  param {
    lr_mult: 5
    decay_mult: 1
    
  }
  param {
    lr_mult: 5
    decay_mult: 0
    
  }
  convolution_param {
    num_output: 64
    kernel_size: 5
    stride: 1
    
    pad: 2
    weight_filler {
      std: 0.01
      type: "gaussian"
      
    }
    bias_filler {
      type: "constant"
      value: 0
      
    }
  }
}

layer {
  name: "s3-2-4-nonlin"
  type: "PReLU"
  bottom: "s3-2-4"
  top: "s3-2-4"
  
  param {
    decay_mult: 0
    lr_mult: 5
    
  }
  
}

layer {
  name: "s3-2-4-drop"
  type: "Dropout"
  bottom: "s3-2-4"
  top: "s3-2-4"
  dropout_param {
    dropout_ratio: 0.5
  }
}

layer {
  name: "s3-2-5-shading"
  type: "Convolution"
  bottom: "s3-2-4"
  top: "s3-2-5-shading"
  param {
    lr_mult: 5
    decay_mult: 1
    
  }
  param {
    lr_mult: 5
    decay_mult: 0
    
  }
  convolution_param {
    num_output: 64
    kernel_size: 5
    stride: 1
    
    pad: 2
    weight_filler {
      std: 0.01
      type: "gaussian"
      
    }
    bias_filler {
      type: "constant"
      value: 0
      
    }
  }
}

layer {
  name: "s3-2-5-shading-nonlin"
  type: "PReLU"
  bottom: "s3-2-5-shading"
  top: "s3-2-5-shading"
  
  param {
    decay_mult: 0
    lr_mult: 5
    
  }
  
}


layer {
  name: "s3-2-5-shading-drop"
  type: "Dropout"
  bottom: "s3-2-5-shading"
  top: "s3-2-5-shading"
  dropout_param {
    dropout_ratio: 0.5
  }
}

layer {
  name: "up-shading-3-3" type: "Deconvolution"
  bottom: "s3-2-5-shading" top: "out-shading-3"
  convolution_param {
    kernel_size: 8 stride: 4
    num_output: 3 
    pad: 2
    weight_filler: { type: "gaussian" std: 0.001 } bias_term: true
  }
  param { lr_mult: 20 decay_mult: 1 }
  param { lr_mult: 20 decay_mult: 0 }
}





# scale-2 conv5 output combine


layer {
  name: "s5-1-out"
  type: "Convolution"
  bottom: "conv5-upsample"
  top: "s5-1-out"
  param {
    lr_mult: 5
    decay_mult: 1
    
  }
  param {
    lr_mult: 5
    decay_mult: 0
    
  }
  convolution_param {
    num_output: 64
    kernel_size: 1
    stride: 1
    
    pad: 0
    weight_filler {
      std: 0.01
      type: "gaussian"
      
    }
    bias_filler {
      type: "constant"
      value: 0
      
    }
  }
}

layer {
  name: "s5-1-out-nonlin"
  type: "PReLU"
  bottom: "s5-1-out"
  top: "s5-1-out"
  
  param {
    decay_mult: 0
    lr_mult: 5
    
  }
  
}


layer {
  name: "s5-1-out-drop"
  type: "Dropout"
  bottom: "s5-1-out"
  top: "s5-1-out"
  dropout_param {
    dropout_ratio: 0.5
  }
}


layer {
  name: "s5-2-1"
  type: "Convolution"
  bottom: "data"
  top: "s5-2-1"
  param {
    lr_mult: 5
    decay_mult: 1
    
  }
  param {
    lr_mult: 5
    decay_mult: 0
    
  }
  convolution_param {
    num_output: 96
    kernel_size: 9
    stride: 1
    
    pad: 4
    weight_filler {
      std: 0.001
      type: "gaussian"
      
    }
    bias_filler {
      type: "constant"
      value: 0
      
    }
  }
}

layer {
  name: "s5-2-1-nonlin"
  type: "PReLU"
  bottom: "s5-2-1"
  top: "s5-2-1"
  
  param {
    decay_mult: 0
    lr_mult: 5
    
  }
  
}


layer {
  name: "s5-2-1-pool"
  type: "Pooling"
  bottom: "s5-2-1"
  top: "s5-2-1-pool"
  pooling_param {
    pool: MAX
    kernel_size: 3
    stride: 2
  }
}




layer {
  name: "s5-2-concat"
  type: "Concat"
  bottom: "s5-2-1-pool" bottom: "s5-1-out" top: "s5-2-concat"
}

layer {
  name: "s5-2-2"
  type: "Convolution"
  bottom: "s5-2-concat"
  top: "s5-2-2"
  param {
    lr_mult: 5
    decay_mult: 1
    
  }
  param {
    lr_mult: 5
    decay_mult: 0
    
  }
  convolution_param {
    num_output: 64
    kernel_size: 5
    stride: 1
    
    pad: 2
    weight_filler {
      std: 0.01
      type: "gaussian"
      
    }
    bias_filler {
      type: "constant"
      value: 0
      
    }
  }
}

layer {
  name: "s5-2-2-nonlin"
  type: "PReLU"
  bottom: "s5-2-2"
  top: "s5-2-2"
  
  param {
    decay_mult: 0
    lr_mult: 5
    
  }
  
}


layer {
  name: "s5-2-2-drop"
  type: "Dropout"
  bottom: "s5-2-2"
  top: "s5-2-2"
  dropout_param {
    dropout_ratio: 0.5
  }
}


layer {
  name: "s5-2-3"
  type: "Convolution"
  bottom: "s5-2-2"
  top: "s5-2-3"
  param {
    lr_mult: 5
    decay_mult: 1
    
  }
  param {
    lr_mult: 5
    decay_mult: 0
    
  }
  convolution_param {
    num_output: 64
    kernel_size: 5
    stride: 1
    
    pad: 2
    weight_filler {
      std: 0.01
      type: "gaussian"
      
    }
    bias_filler {
      type: "constant"
      value: 0
      
    }
  }
}

layer {
  name: "s5-2-3-nonlin"
  type: "PReLU"
  bottom: "s5-2-3"
  top: "s5-2-3"
  
  param {
    decay_mult: 0
    lr_mult: 5
    
  }
  
}


layer {
  name: "s5-2-3-drop"
  type: "Dropout"
  bottom: "s5-2-3"
  top: "s5-2-3"
  dropout_param {
    dropout_ratio: 0.5
  }
}

layer {
  name: "s5-2-4"
  type: "Convolution"
  bottom: "s5-2-3"
  top: "s5-2-4"
  param {
    lr_mult: 5
    decay_mult: 1
    
  }
  param {
    lr_mult: 5
    decay_mult: 0
    
  }
  convolution_param {
    num_output: 64
    kernel_size: 5
    stride: 1
    
    pad: 2
    weight_filler {
      std: 0.01
      type: "gaussian"
      
    }
    bias_filler {
      type: "constant"
      value: 0
      
    }
  }
}

layer {
  name: "s5-2-4-nonlin"
  type: "PReLU"
  bottom: "s5-2-4"
  top: "s5-2-4"
  
  param {
    decay_mult: 0
    lr_mult: 5
    
  }
  
}

layer {
  name: "s5-2-4-drop"
  type: "Dropout"
  bottom: "s5-2-4"
  top: "s5-2-4"
  dropout_param {
    dropout_ratio: 0.5
  }
}

layer {
  name: "s5-2-5-shading"
  type: "Convolution"
  bottom: "s5-2-4"
  top: "s5-2-5-shading"
  param {
    lr_mult: 5
    decay_mult: 1
    
  }
  param {
    lr_mult: 5
    decay_mult: 0
    
  }
  convolution_param {
    num_output: 64
    kernel_size: 5
    stride: 1
    
    pad: 2
    weight_filler {
      std: 0.01
      type: "gaussian"
      
    }
    bias_filler {
      type: "constant"
      value: 0
      
    }
  }
}

layer {
  name: "s5-2-5-shading-nonlin"
  type: "PReLU"
  bottom: "s5-2-5-shading"
  top: "s5-2-5-shading"
  
  param {
    decay_mult: 0
    lr_mult: 5
    
  }
  
}


layer {
  name: "s5-2-5-shading-drop"
  type: "Dropout"
  bottom: "s5-2-5-shading"
  top: "s5-2-5-shading"
  dropout_param {
    dropout_ratio: 0.5
  }
}



layer {
  name: "up-shading-5-3" type: "Deconvolution"
  bottom: "s5-2-5-shading" top: "out-shading-5"
  convolution_param {
    kernel_size: 4 stride: 2
    num_output: 3 
    pad: 1
    weight_filler: { type: "gaussian" std: 0.001 } bias_term: true
  }
  param { lr_mult: 20 decay_mult: 1 }
  param { lr_mult: 20 decay_mult: 0 }
}


# concat conv3 out with conv5 out

layer {
  name: "s3-5-concat"
  type: "Concat"
  bottom: "out-shading-3" bottom: "out-shading-5" 
  top: "out-shading-35"
}

layer {
  name: "s35-out3-33"
  type: "Convolution"
  bottom: "out-shading-35"
  top: "out-matte"
  param {
    lr_mult: 10
    decay_mult: 1
    
  }
  param {
    lr_mult: 10
    decay_mult: 0
    
  }
  convolution_param {
    num_output: 3
    kernel_size: 1
    stride: 1 
    pad: 0
    weight_filler {
      std: 0.01
      type: "gaussian"    
    }
    bias_filler {
      type: "constant"
      value: 0    
    }
  }
}

