caffe之(二)pooling層
阿新 • • 發佈:2019-01-01
在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]; }