caffe模型常用参数解释

来源:互联网 发布:gps监控系统源码 编辑:程序博客网 时间:2024/05/22 06:37
  1. 数据层:  
  2. layer {  
  3.   name: "mnist"//名字mnist  
  4.   type: "Data"//类型data  
  5.   top: "data"//输出数据  
  6.   top: "label"//输出标签
  7.   include {  
  8.     phase: TRAIN  
  9.   }  
  10.   transform_param {  
  11.     scale: 0.00390625//归一化 {0-255}->{0-1} 
  12.   }  
  13.   data_param {  
  14.     source: "examples/mnist/mnist_train_lmdb"  
  15.     batch_size: 64  
  16.     backend: LMDB  
  17.   }  
  18. }  

  19. 卷积层  
  20. layer {  
  21.   name: "conv1"  
  22.   type: "Convolution"  
  23.   bottom: "data"//输入data blob  
  24.   top: "conv1"//输出conv1 
  25.   param {  
  26.     lr_mult: 1//权重学习率倍乘因子。乘以全局学习率
  27.   }  
  28.   param {  
  29.     lr_mult: 2//偏置学习率倍乘因子。乘以全局学习率
  30.   }  
  31.   convolution_param {  
  32.     num_output: 20//cov1层将产生输出20个通道  
  33.     kernel_size: 5//卷积核大小是5*5  
  34.     stride: 1//步长是1  
  35.     weight_filler {//权重初始化方法,使用xavier算法填充weight。
  36.       type: "xavier"  
  37.     }  
  38.     bias_filler {//偏置初始化方法,使用constant算法填充bias。默认是常数0  
  39.       type: "constant"  
  40.     }  
  41.   }  
  42. }  
  43. 池化层 
  44. layer {  
  45.   name: "pool1"  
  46.   type: "Pooling"  
  47.   bottom: "conv1"  
  48.   top: "pool1"  
  49.   pooling_param {  
  50.     pool: MAX//使用MAX进行池化  
  51.     kernel_size: 2//卷积核大小是2*2  
  52.     stride: 2//步长是2  
  53.   }  
  54. }  
  55.   
  56. 全连接层  
  57. layer {  
  58.   name: "ip1"  
  59.   type: "InnerProduct"  
  60.   bottom: "pool2"  
  61.   top: "ip1"  
  62.   param {  
  63.     lr_mult: 1  
  64.   }  
  65.   param {  
  66.     lr_mult: 2  
  67.   }  
  68.   inner_product_param {  
  69.     num_output: 500//产生500维的输出数据  
  70.     weight_filler {  
  71.       type: "xavier"  
  72.     }  
  73.     bias_filler {  
  74.       type: "constant"  
  75.     }  
  76.   }  
  77. }  
  78.   
  79. ReLU层  
  80. layer {  
  81.   name: "relu1"  
  82.   type: "ReLU"  
  83.   bottom: "ip1"  
  84.   top: "ip1"  
  85. }    
  86.  
  87. Loss层 
  88. layer {  
  89.   name: "loss"  
  90.   type: "SoftmaxWithLoss"  
  91.   bottom: "ip2"
  92.   bottom: "label"//来自数据层的标签  
  93.   top: "loss"