CNN network architecture

48 views
Skip to first unread message

rsl

unread,
Mar 4, 2017, 4:56:44 AM3/4/17
to Caffe Users
Hey guys,

I'm new in Caffe, I have a CNN model prototxt which I wanna understand the architecture of network from that.
But the layer name: "ipm0" is kinda confusing for me! But the layer name: "ipm0" says its bottom layer is data ! Does it mean that the name: "ipm0" layer connected to the first layer ?
name: "CaffeNet"
layer
{
  name
: "data0"
  type
:"Data"
  top
: "data0"
  data_param
{
    source
: "/home/florian_buettner/caffe/examples/single_cells/data_150518/sc_train_120602PH5_Cen1Std1_lmdbA0_S"
    backend
: LMDB
    batch_size
: 128
 
}
  transform_param
{
    scale
: 0.00390625
 
}
  include
: { phase: TRAIN }
}
layer
{
  name
: "data0"
  type
:"Data"
  top
: "data0"
  data_param
{
    source
: "/home/florian_buettner/caffe/examples/single_cells/data_150518/sc_val_120602PH5_Cen1Std1_lmdbA0_S"
    backend
: LMDB
    batch_size
: 500
 
}
  transform_param
{
    scale
: 0.00390625
 
}
  include
: { phase: TEST }
}
layer
{
  top
: "data"
  top
: "label"
  name
: "data"
  type
: "HDF5Data"
  hdf5_data_param
{
    source
:"/home/florian_buettner/caffe/examples/single_cells/data_150518/train_120602PH5A0_S_mov.txt"
    batch_size
: 128
 
}
  include
: { phase: TRAIN }
}
layer
{
  top
: "data"
  top
: "label"
  name
: "data"
  type
: "HDF5Data"
  hdf5_data_param
{
    source
:"/home/florian_buettner/caffe/examples/single_cells/data_150518/val_120602PH5A0_S_mov.txt"
    batch_size
: 500
 
}
  include
: { phase: TEST }
}
layer
{
  name
: "conv1"
  type
: "Convolution"
  bottom
: "data0"
  top
: "conv1"
  param
{
    lr_mult
: 1
    decay_mult
: 1
 
}
  param
{
    lr_mult
: 2
    decay_mult
: 0
 
}
  convolution_param
{
    num_output
: 20
    kernel_size
: 5
    stride
: 1
    weight_filler
{
      type
: "gaussian"
      std
: 0.01
   
}
    bias_filler
{
      type
: "constant"
     
   
}
 
}
}
layer
{
  name
: "relu1"
  type
: "ReLU"
  bottom
: "conv1"
  top
: "conv1"
}

layer
{
  name
: "conv1_BN"
  type
: "BatchNorm" include { phase: TRAIN}
  bottom
: "conv1"
  top
: "conv1_BN"
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  batch_norm_param
{
    use_global_stats
: false
    moving_average_fraction
: 0.95
 
}
}
layer
{
  name
: "conv1_BN"
  type
: "BatchNorm" include { phase: TEST}
  bottom
: "conv1"
  top
: "conv1_BN"
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  batch_norm_param
{
    use_global_stats
: true
    moving_average_fraction
: 0.95
 
}
}

layer
{
  name
: "pool1"
  type
: "Pooling"
  bottom
: "conv1_BN"
  top
: "pool1"
  pooling_param
{
    pool
: MAX
    kernel_size
: 2
    stride
: 2
 
}
}
layer
{
  name
: "conv2"
  type
: "Convolution"
  bottom
: "pool1"
  top
: "conv2"
  param
{
    lr_mult
: 1
    decay_mult
: 1
 
}
  param
{
    lr_mult
: 2
    decay_mult
: 0
 
}
  convolution_param
{
    num_output
: 60
    kernel_size
: 4
    stride
: 1
    weight_filler
{
      type
: "gaussian"
      std
: 0.01
   
}
    bias_filler
{
      type
: "constant"
     
   
}
 
}
}
layer
{
  name
: "relu2"
  type
: "ReLU"
  bottom
: "conv2"
  top
: "conv2"
}

layer
{
  name
: "conv2_BN"
  type
: "BatchNorm" include { phase: TRAIN}
  bottom
: "conv2"
  top
: "conv2_BN"
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  batch_norm_param
{
    use_global_stats
: false
    moving_average_fraction
: 0.95
 
}
}
layer
{
  name
: "conv2_BN"
  type
: "BatchNorm" include { phase: TEST}
  bottom
: "conv2"
  top
: "conv2_BN"
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  batch_norm_param
{
    use_global_stats
: true
    moving_average_fraction
: 0.95
 
}
}
layer
{
  name
: "pool2"
  type
: "Pooling"
  bottom
: "conv2_BN"
  top
: "pool2"
  pooling_param
{
    pool
: MAX
    kernel_size
: 2
    stride
: 2
 
}
}
layer
{
  name
: "conv3"
  type
: "Convolution"
  bottom
: "pool2"
  top
: "conv3"
  param
{
    lr_mult
: 1
    decay_mult
: 1
 
}
  param
{
    lr_mult
: 2
    decay_mult
: 0
 
}
  convolution_param
{
    num_output
: 100
    kernel_size
: 3
    stride
: 1
    weight_filler
{
      type
: "gaussian"
      std
: 0.01
   
}
    bias_filler
{
      type
: "constant"
     
   
}
 
}
}

layer
{
  name
: "relu3"
  type
: "ReLU"
  bottom
: "conv3"
  top
: "conv3"
}


layer
{
  name
: "conv3_BN"
  type
: "BatchNorm" include { phase: TRAIN}
  bottom
: "conv3"
  top
: "conv3_BN"
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  batch_norm_param
{
    use_global_stats
: false
    moving_average_fraction
: 0.95
 
}
}
layer
{
  name
: "conv3_BN"
  type
: "BatchNorm" include { phase: TEST}
  bottom
: "conv3"
  top
: "conv3_BN"
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  batch_norm_param
{
    use_global_stats
: true
    moving_average_fraction
: 0.95
 
}
}
layer
{
  name
: "pool5"
  type
: "Pooling"
  bottom
: "conv3_BN"
  top
: "pool5"
  pooling_param
{
    pool
: MAX
    kernel_size
: 2
    stride
: 2
 
}
}
layer
{
  name
: "fc6"
  type
: "InnerProduct"
  bottom
: "pool5"
  top
: "fc6"
  param
{
    lr_mult
: 1
    decay_mult
: 1
 
}
  param
{
    lr_mult
: 2
    decay_mult
: 0
 
}
  inner_product_param
{
    num_output
: 500
    weight_filler
{
      type
: "gaussian"
      std
: 0.005
   
}
    bias_filler
{
      type
: "constant"
     
   
}
 
}
}

layer
{
  name
: "relu6"
  type
: "ReLU"
  bottom
: "fc6"
  top
: "fc6"
}

layer
{
  name
: "ipm0"
  type
: "InnerProduct"
  bottom
: "data"
  top
: "ipm0"
  param
{
    lr_mult
: 1
    decay_mult
: 1
 
}
  param
{
    lr_mult
: 2
    decay_mult
: 0
 
}
  inner_product_param
{
    num_output
: 1
    weight_filler
{
      type
: "xavier"
   
}
    bias_filler
{
      type
: "constant"
   
}
 
}
}
layer
{
  name
: "relum1"
  type
: "ReLU"
  bottom
: "ipm0"
  top
: "relum1"
}

layer
{
  name
: "concat"
  bottom
: "fc6"
  bottom
: "relum1"
  top
: "concat"
  type
: "Concat"
  concat_param
{
    concat_dim
: 1
 
}
}
layer
{
  name
: "fc6_BN"
  type
: "BatchNorm" include { phase: TRAIN}
  bottom
: "concat"
  top
: "fc6_BN"
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  batch_norm_param
{
    use_global_stats
: false
    moving_average_fraction
: 0.95
 
}
}
layer
{
  name
: "fc6_BN"
  type
: "BatchNorm" include { phase: TEST}
  bottom
: "concat"
  top
: "fc6_BN"
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  batch_norm_param
{
    use_global_stats
: true
    moving_average_fraction
: 0.95
 
}
}
layer
{
  name
: "drop6"
  type
: "Dropout"
  bottom
: "fc6_BN"
  top
: "drop6"
  dropout_param
{
    dropout_ratio
: 0.5
 
}
}
layer
{
  name
: "fc7"
  type
: "InnerProduct"
  bottom
: "drop6"
  top
: "fc7"
  param
{
    lr_mult
: 1
    decay_mult
: 1
 
}
  param
{
    lr_mult
: 2
    decay_mult
: 0
 
}
  inner_product_param
{
    num_output
: 50
    weight_filler
{
      type
: "gaussian"
      std
: 0.005
   
}
    bias_filler
{
      type
: "constant"
     
   
}
 
}
}
layer
{
  name
: "relu7"
  type
: "ReLU"
  bottom
: "fc7"
  top
: "fc7"
}


layer
{
  name
: "fc7_BN"
  type
: "BatchNorm" include { phase: TRAIN}
  bottom
: "fc7"
  top
: "fc7_BN"
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  batch_norm_param
{
    use_global_stats
: false
    moving_average_fraction
: 0.95
 
}
}
layer
{
  name
: "fc7_BN"
  type
: "BatchNorm" include { phase: TEST}
  bottom
: "fc7"
  top
: "fc7_BN"
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  param
{
    lr_mult
: 0
    decay_mult
: 0
 
}
  batch_norm_param
{
    use_global_stats
: true
    moving_average_fraction
: 0.95
 
}
}


layer
{
  name
: "drop7"
  type
: "Dropout"
  bottom
: "fc7_BN"
  top
: "drop7"
  dropout_param
{
    dropout_ratio
: 0.5
 
}
}
layer
{
  name
: "fc8"
  type
: "InnerProduct"
  bottom
: "drop7"
  top
: "fc8"
  param
{
    lr_mult
: 1
    decay_mult
: 1
 
}
  param
{
    lr_mult
: 2
    decay_mult
: 0
 
}
  inner_product_param
{
    num_output
: 2
    weight_filler
{
      type
: "gaussian"
      std
: 0.01
   
}
    bias_filler
{
      type
: "constant"
     
   
}
 
}
}
layer
{
  name
: "accuracy"
  type
: "Accuracy"
  bottom
: "fc8"
  bottom
: "label"
  top
: "accuracy"
  include
{
    phase
: TEST
 
}
}
layer
{
  name
: "loss"
  type
: "SoftmaxWithLoss"
  bottom
: "fc8"
  bottom
: "label"
  top
: "loss"
}



rsl

unread,
Mar 4, 2017, 4:58:47 AM3/4/17
to Caffe Users
 I thought the the order of network architecture supposed be some thing like this which the second fully connected layer is linked to the first fully connected layer! Please correct me if I'm wrong!

Input -> Convolution layer (5,5)-> ReLU layer -> Batch Normalization layer -> Pool Layer (2,2) ->
Convolution layer (4,4)-> ReLU layer -> Batch Normalization layer -> Pool Layer (2,2) ->
Convolution layer (3,3)-> ReLU layer -> Batch Normalization layer -> Pool Layer (2,2) ->
Fully connected Layer ( 500) ->
ReLU layer -> Batch Normalization layer -> Dropout layer ->
Fully connected Layer ( 50) -> ReLU layer -> Batch Normalization layer ->  Dropout layer ->
Softmax layer


Przemek D

unread,
Mar 6, 2017, 4:06:38 AM3/6/17
to Caffe Users
You can use the draw_net.py (found in caffe/python) script to visualize a network as a neat block diagram of layers and connections, it will be much easier for you to understand the architecture from there.

Basic AlexNet architecture is like you say, input->(conv->relu)->(fc->relu)->softmax. But tons of much more complex architectures exist and you shouldn't think that there is some "good" one that should be used.
Reply all
Reply to author
Forward
0 new messages