本文主要是介绍caffe CNN train_val.prototxt 神经网络参数配置说明,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
name: "CaffeNet"
layer {
#输入层,即数据层
#数据层的类型除了Database外,还可以是In-Memory、HDF5 Input、HDF5 Output、Images、Windows、Dummy
name: "data"
type: "Data"
top: "data"
top: "label"
include {
phase: TRAIN
#表示仅在训练阶段包括进去
}
transform_param {
#对数据进行预处理,依次是做镜像,设定crop大小,减去均值文件
mirror: true
crop_size: 60
mean_file: "/home/stack/caffe-master/data/HQPData/0902/img0902_mean.binaryproto"
}
data_param {
#设定数据来源
source: "/home/stack/caffe-master/examples/HuQPTask/0902/train_lmdb"
#包含数据的目录名称
batch_size: 50
#一次处理的输入的数量
backend: LMDB
#选择使用 LEVELDB 或者 LMDB
}
}
layer {
name: "data"
type: "Data"
top: "data"
top: "label"
include {
phase: TEST
}
transform_param {
mirror: true
crop_size: 60
mean_file: "/home/stack/caffe-master/data/HQPData/0902/img0902_mean.binaryproto"
}
data_param {
source: "/home/stack/caffe-master/examples/HuQPTask/0902/val_lmdb"
batch_size: 50
backend: LMDB
}
}
layer {
#Convolution
#卷积层
name: "conv1"
type: "Convolution"
bottom: "data"
top: "conv1"
param {
#过滤器/权重 参数
lr_mult: 1
# learning rate multiplier for the filters
#学习率倍数
decay_mult: 1
# weight decay multiplier for the filters
#权重衰减率
}
param {
#偏置 参数
lr_mult: 2
# learning rate multiplier for the biases
#学习率倍数
decay_mult: 0
# weight decay multiplier for the biases
#权重衰减率
}
convolution_param {
num_output: 96
# learn 96 filters
kernel_size: 3
# each filter is 3x3
stride: 1
# step 1 pixels between each filter application
weight_filler {
#初始化权重/过滤器:均值默认为0,标准差0.01的高斯函数
type: "gaussian"
# initialize the filters from a Gaussian
std: 0.01
# distribution with stdev 0.01 (default mean: 0)
}
bias_filler {
#初始化偏置:常数0
# initialize the biases to zero (0)
type: "constant"
value: 0
}
}
}
layer {
#Rectified-Linear and Leaky-ReLU 校正线性
#Activation / Neuron Layers 激励层,除了ReLu外,还可以用Sigmoid、TanH 、Absolute Value、Power、BNLL
#ReLU是目前使用做多的激励函数,主要因为其收敛更快,并且能保持同样效果。
#标准的ReLU函数为max(x, 0),而一般为当x > 0时输出x,但x <= 0时输出negative_slope。RELU层支持in-place计算,这意味着bottom的输出和输入相同以避免内存的消耗。
name: "relu1"
type: "ReLU"
bottom: "conv1"
top: "conv1"
}
layer {
#Pooling 下采样层
#池化层
name: "pool1"
type: "Pooling"
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX
#pooling的方法,目前有MAX, AVE, 和STOCHASTIC三种方法
kernel_size: 3
# pool over a 3x3 region
stride: 2
# step two pixels (in the bottom blob) between pooling regions
}
}
layer {
#Local Response Normalization
#局部输入区域归一化
#这里需要看公式,以下参数是指公式中的参数
name: "norm1"
type: "LRN"
bottom: "pool1"
top: "norm1"
lrn_param {
local_size: 5
alpha: 0.0001
beta: 0.75
}
}
layer {
name: "conv2"
type: "Convolution"
bottom: "norm1"
top: "conv2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 256
pad: 2
kernel_size: 5
group: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 1
}
}
}
layer {
name: "relu2"
type: "ReLU"
bottom: "conv2"
top: "conv2"
}
layer {
name: "pool2"
type: "Pooling"
bottom: "conv2"
top: "pool2"
pooling_param {
pool: MAX
kernel_size: 3
stride: 1
}
}
layer {
name: "norm2"
type: "LRN"
bottom: "pool2"
top: "norm2"
lrn_param {
local_size: 5
alpha: 0.0001
beta: 0.75
}
}
layer {
name: "conv3"
type: "Convolution"
bottom: "norm2"
top: "conv3"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 384
pad: 1
kernel_size: 3
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "relu3"
type: "ReLU"
bottom: "conv3"
top: "conv3"
}
layer {
name: "conv4"
type: "Convolution"
bottom: "conv3"
top: "conv4"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 384
pad: 1
kernel_size: 3
group: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 1
}
}
}
layer {
name: "relu4"
type: "ReLU"
bottom: "conv4"
top: "conv4"
}
layer {
name: "conv5"
type: "Convolution"
bottom: "conv4"
top: "conv5"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
group: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 1
}
}
}
layer {
name: "relu5"
type: "ReLU"
bottom: "conv5"
top: "conv5"
}
layer {
name: "pool5"
type: "Pooling"
bottom: "conv5"
top: "pool5"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
#Common Layers
#全连接层 Inner Product
name: "fc6"
type: "InnerProduct"
bottom: "pool5"
top: "fc6"
param {
lr_mult: 1
# learning rate multiplier for the filters
decay_mult: 1
# weight decay multiplier for the filters
}
param {
lr_mult: 2
# learning rate multiplier for the biases
decay_mult: 0
# weight decay multiplier for the biases
}
inner_product_param {
num_output: 4096
weight_filler {
type: "gaussian"
std: 0.005
}
bias_filler {
type: "constant"
value: 1
}
}
}
layer {
name: "relu6"
type: "ReLU"
bottom: "fc6"
top: "fc6"
}
layer {
name: "drop6"
type: "Dropout"
bottom: "fc6"
top: "fc6"
dropout_param {
dropout_ratio: 0.5
#丢弃数据的概率
}
}
layer {
name: "fc7"
type: "InnerProduct"
bottom: "fc6"
top: "fc7"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
inner_product_param {
num_output: 4096
weight_filler {
type: "gaussian"
std: 0.005
}
bias_filler {
type: "constant"
value: 1
}
}
}
layer {
name: "relu7"
type: "ReLU"
bottom: "fc7"
top: "fc7"
}
layer {
name: "drop7"
type: "Dropout"
bottom: "fc7"
top: "fc7"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc8"
type: "InnerProduct"
bottom: "fc7"
top: "fc8"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
inner_product_param {
num_output: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
#Loss Layers损耗层
#Accuracy准确率层(计算准确率)用来计算输出和目标的正确率
#事实上这不是一个loss,而且没有backward这一步。
name: "accuracy"
type: "Accuracy"
bottom: "fc8"
bottom: "label"
top: "accuracy"
include {
phase: TEST
}
}
layer {
#损失估计层
name: "loss"
type: "SoftmaxWithLoss"
bottom: "fc8"
bottom: "label"
top: "loss"
}
这篇关于caffe CNN train_val.prototxt 神经网络参数配置说明的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!