caffe模型引數的一些解釋
阿新 • • 發佈:2018-12-31
作者:wjmishuai
原始資料是28*28 1:資料層: layer { name: "mnist"//資料層的名字是mnist type: "Data"//這個層的型別是data top: "data"//產生兩個blob,一個是data blob top: "label"//一個是lable blob include { phase: TRAIN } transform_param { scale: 0.00390625//畫素歸一化 } data_param { source: "examples/mnist/mnist_train_lmdb" batch_size: 64 backend: LMDB } } 2:卷積層 layer { name: "conv1" type: "Convolution" bottom: "data"//獲取上一層的data blob top: "conv1"//產生conv1層 param { lr_mult: 1//學習率。表示 weight的學習率和slover.pro中的學習率是一致的。 } param { lr_mult: 2//表示 bias的學習率是slover.pro中的學習率的2倍。 這樣設定會導致更快的收斂 } convolution_param { num_output: 20//cov1層將產生輸出20個通道 kernel_size: 5//卷積核大小是5*5 stride: 1//步長是1 weight_filler {//權重填充器,使用xavier演算法填充weight。根據輸入和輸出神經元的數量自動確定初始化的規模。 type: "xavier" } bias_filler {//偏置填充器,使用constant演算法填充bias。是一個常數,預設是0 type: "constant" } } } 3:池化層(避免資料過擬合) layer { name: "pool1" type: "Pooling" bottom: "conv1" top: "pool1" pooling_param { pool: MAX//使用MAX進行池化 kernel_size: 2//卷積核大小是2*2 stride: 2//步長是2 } } 4:全連線層 layer { name: "ip1" type: "InnerProduct" bottom: "pool2" top: "ip1" param { lr_mult: 1 } param { lr_mult: 2 } inner_product_param { num_output: 500//產生500維的輸出資料 weight_filler { type: "xavier" } bias_filler { type: "constant" } } } 5:ReLU層(緊跟在全連線層後,目的是節省記憶體) layer { name: "relu1" type: "ReLU" bottom: "ip1" top: "ip1" } ReLU層後緊跟一個InnerProduct層 layer { name: "ip2" type: "InnerProduct" bottom: "ip1" top: "ip2" param { lr_mult: 1 } param { lr_mult: 2 } inner_product_param { num_output: 10//因為有10類,所以輸出10 weight_filler { type: "xavier" } bias_filler { type: "constant" } } } 6:Loss層//不產生任何輸出,只是用來計算損失函式的值,用來初始化ip2的gradient layer { name: "loss" type: "SoftmaxWithLoss" bottom: "ip2"//需要兩個blob,一個是ip2,作為預測用 bottom: "label"//來自資料層,作為標籤 top: "loss" }