// 輸入層的定義:
name: "LeNet" (網絡的名字)
layer { (定義一個網絡層)
name: "data" (網絡層的名字為 data)
type: "Input" (網絡層的類型,輸入)
top: "data" (該網絡層的輸出叫 data )
input_param { shape: { dim: 64 dim: 1 dim: 28 dim: 28 } } }(64張圖像為一批,28*28大小)
}
////讀取這批數據維度:64 1 28 28
// 第一卷積層的定義:
layer {
name: "conv1" (網絡層的名字為 conv1)
type: "Convolution" (網絡層類型是 卷積層)
bottom: "data" (該層的輸入層是 data 層)
top: "conv1" (該層的輸出層叫 conv1 feature maps)
param {
lr_mult: 1 (weights的學習率與全局相同)
}
param {
lr_mult: 2 (biases的學習率是全局的2倍)
}
convolution_param { {(卷積操作參數設置)
num_output: 20 (卷積輸出數量20,由20個特征圖Feature Map構成)
kernel_size: 5 (卷積核的大小是5*5)
stride: 1 (卷積操作步長)
weight_filler {
type: "xavier" (卷積濾波器的參數使用 xavier 方法來初始化)
}
bias_filler {
type: "constant" (bias使用0初始化)
}
}
}
////卷積之后這批數據維度:64 20 24 24
// 第一池化層定義:
layer {
name: "pool1" (網絡層的名字是 pool1 )
type: "Pooling" (網絡層的類型是 池化操作)
bottom: "conv1" (網絡層的輸入是 conv1 feature maps)
top: "pool1" (網絡層的輸出是 pool1)
pooling_param { (池化參數設置)
pool: MAX (最大池化操作)
kernel_size: 2 (池化核尺寸,2*2 區域池化)
stride: 2 (池化步長)
}
}
////池化之后這批數據維度:64 20 12 12
// 第二卷積層的定義:
layer {
name: "conv2" (該網絡層的名字)
type: "Convolution" (該網絡層的類型,卷積)
bottom: "pool1" (該網絡層的輸入是 pool1)
top: "conv2" (該網絡層的輸出是 conv2, feature maps)
param {
lr_mult: 1 (weights的學習率與全局相同)
}
param {
lr_mult: 2 (biases的學習率是全局的2倍)
}
convolution_param { (卷積參數設置)
num_output: 50 (卷積的輸出個數,由50個特征圖Feature Map構成)
kernel_size: 5 (卷積核尺寸 5*5)
stride: 1 (卷積步長)
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
////卷積之后這批數據維度:64 50 8 8
// 第二池化層的定義:
layer {
name: "pool2"
type: "Pooling"
bottom: "conv2"
top: "pool2"
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
////池化之后這批數據維度:64 50 4 4
// 第一層全鏈接層的定義:
layer {
name: "ip1" (該網絡層的名字 ip1)
type: "InnerProduct" (該網絡層的類型是 全鏈接層)
bottom: "pool2" (該層的輸入是 pool2)
top: "ip1" (該層的輸出是 ip1)
param {
lr_mult: 1
}
param {
lr_mult: 2
}
inner_product_param { (全鏈接層的 參數設置)
num_output: 500 (500個輸出神經元)
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
////500 個神經元
// 激活函數層的定義:
layer {
name: "relu1" (該網絡層的名字 relu1)
type: "ReLU" (該網絡層的類型, ReLU 激活函數)
bottom: "ip1" (該層的輸入是 ip1)
top: "ip1" (該層的輸出還是 ip1,底層與頂層相同是為了減少開支)
}
// 第二全鏈接層的定義:(數據的分類判斷在這一層中完成)
layer {
name: "ip2"
type: "InnerProduct"
bottom: "ip1"
top: "ip2"
param {
lr_mult: 1
}
param {
lr_mult: 2
}
inner_product_param {
num_output: 10 (直接輸出結果,0-9,十個數字所以維度是10)
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
// 輸出層的定義:
layer {
name: "prob"
type: "Softmax" (損失函數)
bottom: "ip2"
top: "prob"
}