name: "LeNet"
layer {
name: "mnist"
type: "Data"
top: "data" #this layer produces two blobs, one is the data blob, and one is the label blob.
top: "label"
include {
phase: TRAIN #这个层仅在train阶段
}
transform_param { #数据的预处理,可以将数据变换到定义的范围内。
scale: 0.00390625 # 1 divided by 256 即将输入数据(RGB)由0-255归一化到0-1之间
}
data_param {
source: "examples/mnist/mnist_train_lmdb"
batch_size: 64 #每次处理的数据个数,如64
backend: LMDB #选择是采用LevelDB还是LMDB, 默认是LevelDB.
}
}
layer {
name: "mnist"
type: "Data"
top: "data"
top: "label"
include {
phase: TEST #这个层仅在test阶段
}
transform_param {
scale: 0.00390625
}
data_param {
source: "examples/mnist/mnist_test_lmdb"
batch_size: 100 #测试数据100张为一批
backend: LMDB
}
}
layer { #conv1(即产生图上 C1数据)层是一个卷积层
name: "conv1"
type: "Convolution"
bottom: "data"
top: "conv1"
param { #the learning rate adjustments for the layer’s learnable parameters
lr_mult: 1 #the weight learning rate
}
param {
lr_mult: 2 # the bias learning rate to be twice as large as that - this usually leads to better convergence rates.
}
convolution_param {
num_output: 20 #卷积和的个数produces outputs of 20 channels
kernel_size: 5 #卷积核的大小是5*5
stride: 1 #卷积步长为1
weight_filler {
type: "xavier" #使用xavier算法根据输入和输出的神经元数目来决定初始化的范围
}
bias_filler { #偏置初始化为常数,0
type: "constant"
}
}
}
layer { #pool1(即产生S2数据)是一个降采样层
name: "pool1"
type: "Pooling"
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX # max pooling
kernel_size: 2 #降采样的核是2*2的
stride: 2 #步长为2
}
}
layer { #conv2(即产生C3数据)是卷积层
name: "conv2"
type: "Convolution"
bottom: "pool1"
top: "conv2"
param { #学习率的系数,最终的学习率是这个数乘以solver.prototxt配置文件中的base_lr
lr_mult: 1 #第一个表示权值的学习率
}
param {
lr_mult: 2 #第二个表示偏置项的学习率
}
convolution_param {
num_output: 50 #50个特征
kernel_size: 5
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
layer { #pool2(即产生S3数据)是降采样层,降采样核为2*2,则数据变成4*4
name: "pool2"
type: "Pooling" #池化层
bottom: "conv2"
top: "pool2"
pooling_param {
pool: MAX #池化方法,默认为MAX
kernel_size: 2 #池化的核大小
stride: 2 #池化的步长,默认为1。一般设置为2,即不重叠。
}
}
layer { #ip1 是全连接层(产生C5的数据)。某个程度上可以认为是卷积层。输出为500
name: "ip1"
type: "InnerProduct"
bottom: "pool2"
top: "ip1"
param {
lr_mult: 1
}
param {
lr_mult: 2
}
inner_product_param {
num_output: 500
weight_filler { # 权值初始化。 默认为“constant",值全为0,很多时候用"xavier"算法来进行初始化
type: "xavier"
}
bias_filler { #偏置项的初始化。一般设置为"constant",值全为0。
type: "constant"
}
}
}
layer { #线性修正函数,giving the same name to the bottom and top blobs
name: "relu1"
type: "ReLU"
bottom: "ip1"
top: "ip1"
}
layer { #内积层,ip2是第二个全连接层,输出为10,直接输出结果,数据的分类判断在这一层中完成。
name: "ip2"
type: "InnerProduct"
bottom: "ip1"
top: "ip2"
param { #学习率的系数
lr_mult: 1
}
param {
lr_mult: 2
}
inner_product_param {
num_output: 10 #过滤器(filfter)的个数
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
layer { #输出分类(预测)精确度,只有test阶段才有,因此需要加入include参数
name: "accuracy"
type: "Accuracy"
bottom: "ip2"
bottom: "label"
top: "accuracy"
include {
phase: TEST #this layer will be included only in TRAIN phase,If we change TRAIN with TEST, then this layer will be used only in test phase.
}
}
layer { #It takes two blobs, the first one being the prediction and the second one being the label provided by the data layer
name: "loss"
type: "SoftmaxWithLoss"
bottom: "ip2"
bottom: "label"
top: "loss"
layer {
name: "mnist"
type: "Data"
top: "data" #this layer produces two blobs, one is the data blob, and one is the label blob.
top: "label"
include {
phase: TRAIN #这个层仅在train阶段
}
transform_param { #数据的预处理,可以将数据变换到定义的范围内。
scale: 0.00390625 # 1 divided by 256 即将输入数据(RGB)由0-255归一化到0-1之间
}
data_param {
source: "examples/mnist/mnist_train_lmdb"
batch_size: 64 #每次处理的数据个数,如64
backend: LMDB #选择是采用LevelDB还是LMDB, 默认是LevelDB.
}
}
layer {
name: "mnist"
type: "Data"
top: "data"
top: "label"
include {
phase: TEST #这个层仅在test阶段
}
transform_param {
scale: 0.00390625
}
data_param {
source: "examples/mnist/mnist_test_lmdb"
batch_size: 100 #测试数据100张为一批
backend: LMDB
}
}
layer { #conv1(即产生图上 C1数据)层是一个卷积层
name: "conv1"
type: "Convolution"
bottom: "data"
top: "conv1"
param { #the learning rate adjustments for the layer’s learnable parameters
lr_mult: 1 #the weight learning rate
}
param {
lr_mult: 2 # the bias learning rate to be twice as large as that - this usually leads to better convergence rates.
}
convolution_param {
num_output: 20 #卷积和的个数produces outputs of 20 channels
kernel_size: 5 #卷积核的大小是5*5
stride: 1 #卷积步长为1
weight_filler {
type: "xavier" #使用xavier算法根据输入和输出的神经元数目来决定初始化的范围
}
bias_filler { #偏置初始化为常数,0
type: "constant"
}
}
}
layer { #pool1(即产生S2数据)是一个降采样层
name: "pool1"
type: "Pooling"
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX # max pooling
kernel_size: 2 #降采样的核是2*2的
stride: 2 #步长为2
}
}
layer { #conv2(即产生C3数据)是卷积层
name: "conv2"
type: "Convolution"
bottom: "pool1"
top: "conv2"
param { #学习率的系数,最终的学习率是这个数乘以solver.prototxt配置文件中的base_lr
lr_mult: 1 #第一个表示权值的学习率
}
param {
lr_mult: 2 #第二个表示偏置项的学习率
}
convolution_param {
num_output: 50 #50个特征
kernel_size: 5
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
layer { #pool2(即产生S3数据)是降采样层,降采样核为2*2,则数据变成4*4
name: "pool2"
type: "Pooling" #池化层
bottom: "conv2"
top: "pool2"
pooling_param {
pool: MAX #池化方法,默认为MAX
kernel_size: 2 #池化的核大小
stride: 2 #池化的步长,默认为1。一般设置为2,即不重叠。
}
}
layer { #ip1 是全连接层(产生C5的数据)。某个程度上可以认为是卷积层。输出为500
name: "ip1"
type: "InnerProduct"
bottom: "pool2"
top: "ip1"
param {
lr_mult: 1
}
param {
lr_mult: 2
}
inner_product_param {
num_output: 500
weight_filler { # 权值初始化。 默认为“constant",值全为0,很多时候用"xavier"算法来进行初始化
type: "xavier"
}
bias_filler { #偏置项的初始化。一般设置为"constant",值全为0。
type: "constant"
}
}
}
layer { #线性修正函数,giving the same name to the bottom and top blobs
name: "relu1"
type: "ReLU"
bottom: "ip1"
top: "ip1"
}
layer { #内积层,ip2是第二个全连接层,输出为10,直接输出结果,数据的分类判断在这一层中完成。
name: "ip2"
type: "InnerProduct"
bottom: "ip1"
top: "ip2"
param { #学习率的系数
lr_mult: 1
}
param {
lr_mult: 2
}
inner_product_param {
num_output: 10 #过滤器(filfter)的个数
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
layer { #输出分类(预测)精确度,只有test阶段才有,因此需要加入include参数
name: "accuracy"
type: "Accuracy"
bottom: "ip2"
bottom: "label"
top: "accuracy"
include {
phase: TEST #this layer will be included only in TRAIN phase,If we change TRAIN with TEST, then this layer will be used only in test phase.
}
}
layer { #It takes two blobs, the first one being the prediction and the second one being the label provided by the data layer
name: "loss"
type: "SoftmaxWithLoss"
bottom: "ip2"
bottom: "label"
top: "loss"
}
推荐:徐其华的博客有更详细的说明 http://www.cnblogs.com/denny402/p/5073427.html