Deep learning framework by BAIR
Created by
Yangqing Jia
Lead Developer
Evan Shelhamer
Pooling./include/caffe/layers/pooling_layer.hpp./src/caffe/layers/pooling_layer.cppCUDA GPU implementation: ./src/caffe/layers/pooling_layer.cu
n * c * h_i * w_in * c * h_o * w_o, where h_o and w_o are computed in the same way as convolution.PoolingParameter pooling_param)
kernel_size (or kernel_h and kernel_w): specifies height and width of each filterpool [default MAX]: the pooling method. Currently MAX, AVE, or STOCHASTICpad (or pad_h and pad_w) [default 0]: specifies the number of pixels to (implicitly) add to each side of the inputstride (or stride_h and stride_w) [default 1]: specifies the intervals at which to apply the filters to the input./src/caffe/proto/caffe.proto: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];
}Sample (as seen in ./models/bvlc_reference_caffenet/train_val.prototxt)
layer {
name: "pool1"
type: "Pooling"
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 3 # pool over a 3x3 region
stride: 2 # step two pixels (in the bottom blob) between pooling regions
}
}