【参考】
1、Data层
layer {
name: "cifar"
type: "Data"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
mean_file: "examples/cifar10/mean.binaryproto"
}
data_param {
source: "examples/cifar10/cifar10_train_lmdb"
batch_size: 100
backend: LMDB
}
}
【Convolution、Pooling】
2、Convolution层
layer {
name: "conv1"
type: "Convolution"
bottom: "data"
top: "conv1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 96
kernel_size: 11
stride: 4
pad: 2
weight_filler {
type: "gaussian"
std: 0.01 #标准差:distribution with stdev 0.01(default mean: 0)
}
bias_filler {
type: "constant"
value: 0
}
}
}
3、pooling层
layer {
name: "pool1"
type: "Pooling"
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
4、Local Response Normalization层
LRN是对一个局部的输入进行的归一化操作。【貌似现在不怎么用了】
5、im2col层
在caffe中,卷积运算就是先对数据矩阵进行im2col操作,在进行内积运算,这样做,会比原始的卷积操作更快。
【InnerProductLayer、SplitLayer、FlattenLayer、ConcatLayer、SilenceLayer、(Elementwise Operations)这个是我们常说的激活函数层Activation Layers、EltwiseLayer、SoftmaxLayer、ArgMaxLayer、MVNLayer】
6、inner_product层(FC)
layers {
name: "fc8"
type: "InnerProduct"
blobs_lr: 1 # learning rate multiplier for the filters
blobs_lr: 2 # learning rate multiplier for the biases
weight_decay: 1 # weight decay multiplier for the filters
weight_decay: 0 # weight decay multiplier for the biases
inner_product_param {
num_output: 1000
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
bottom: "fc7"
top: "fc8"
7、accuracy
layer {
name: "accuracy"
type: "Accuracy"
bottom: "ip2"
bottom: "label"
top: "accuracy"
include {
phase: TEST
}
}
8、reshape
layer {
name: "reshape"
type: "Reshape"
bottom: "input"
top: "output"
reshape_param {
shape {
dim: 0 # copy the dimension from below
dim: 2
dim: 3
dim: -1 # infer it from the other dimensions
}
}
}
9、dropout
layer {
name: "drop7"
type: "Dropout"
bottom: "fc7-conv"
top: "fc7-conv"
dropout_param {
dropout_ratio: 0.5 #只需要设置一个dropout_ratio参数即可
}
}
10、Sigmoid
layer {
name: "encode1neuron"
bottom: "encode1"
top: "encode1neuron"
type: "Sigmoid"
}
11、ReLU/Rectified-linear and Leaky-ReLU
layers {
name: "relu1"
type: RELU
bottom: "conv1"
top: "conv1"
}
12、TanH/Hyperbolic Tangent
layer {
name: "layer"
bottom: "in"
top: "out"
type: "TanH"
}
13、Absolute value(绝对值)
layer {
name: "layer"
bottom: "in"
top: "out"
type: "AbsVal"
}
14、Power(幂运算)
layer {
name: "layer"
bottom: "in"
top: "out"
type: "Power"
power_param {
power: 2
scale: 1
shift: 0
}
}
15、BNLL(binomial normal log likelihood)
layer {
name: "layer"
bottom: "in"
top: "out"
type: “BNLL”
}
【待续,还有很多的】
16、softmax-loss
layer {
name: "loss"
type: "SoftmaxWithLoss"
bottom: "ip1"
bottom: "label"
top: "loss"
}
ps:
Stochastic Gradient Descent (type: "SGD"),
AdaDelta (type: "AdaDelta"),
Adaptive Gradient (type: "AdaGrad"),
Adam (type: "Adam"),
Nesterov’s Accelerated Gradient (type: "Nesterov") and
RMSprop (type: "RMSProp")
1. 设计好需要优化的对象,以及用于学习的训练网络和用于评估的测试网络。(通过调用另外一个配置文件prototxt来进行)
2. 通过forward和backward迭代的进行优化来跟新参数。
3. 定期的评价测试网络。 (可设定多少次训练后,进行一次测试)
4. 在优化过程中显示模型和solver的状态
#每一次的迭代过程
• 1、调用forward算法来计算最终的输出值,以及对应的loss
• 2、调用backward算法来计算每层的梯度
• 3、根据选用的slover方法,利用梯度进行参数更新
• 4、记录并保存每次迭代的学习率、快照,以及对应的状态。