caffe之(二)pooling层

在caffe中,网络的结构由prototxt文件中给出,由一些列的Layer(层)组成,常用的层如:数据加载层、卷积操作层、pooling层、非线性变换层、内积运算层、归一化层、损失计算层等;本篇主要介绍pooling层

1. Pooling层总述

下面首先给出pooling层的结构设置的一个小例子(定义在.prototxt文件中) 

layer {
  name: "pool1"   //该层的名称
  type: "Pooling"  //该层的类型
  bottom: "norm1"  //该层的输入数据blob
  top: "pool1"   //该层的输出数据blob

  // 该层的相关参数设置
  pooling_param {
    pool: MAX  //pooling类型,默认值为MAX,也可以设置为AVE,STOCHASTIC
    kernel_size: 3  //pooling核大小,为必设参数
    stride: 2  //pooling核步长,默认值为1(即重叠),但通常设置为2;
  }

}

 

注:在caffe的原始proto文件中,关于卷积层的参数PoolingParameter定义如下:

message PoolingParameter {
  enum PoolMethod {
    MAX = 0;
    AVE = 1;
    STOCHASTIC = 2;
  }
  optional PoolMethod pool = 1 [default = MAX]; // The pooling method
  // Pad, kernel size, and stride are all given as a single value for equal
  // dimensions in height and width or as Y, X pairs.
  optional uint32 pad = 4 [default = 0]; // The padding size (equal in Y, X)
  optional uint32 pad_h = 9 [default = 0]; // The padding height
  optional uint32 pad_w = 10 [default = 0]; // The padding width
  optional uint32 kernel_size = 2; // The kernel size (square)
  optional uint32 kernel_h = 5; // The kernel height
  optional uint32 kernel_w = 6; // The kernel width
  optional uint32 stride = 3 [default = 1]; // The stride (equal in Y, X)
  optional uint32 stride_h = 7; // The stride height
  optional uint32 stride_w = 8; // The stride width
  enum Engine {
    DEFAULT = 0;
    CAFFE = 1;
    CUDNN = 2;
  }
  optional Engine engine = 11 [default = DEFAULT];
  // If global_pooling then it will pool over the size of the bottom by doing
  // kernel_h = bottom->height and kernel_w = bottom->width
  optional bool global_pooling = 12 [default = false];
}

 

 
posted @ 2016-03-04 00:54  纸鸢spring  阅读(6065)  评论(0编辑  收藏  举报