本文主要是自己平时训练参数调整的总结,后续也不断的完善,由于以前训练调参过程中,没有总结总是忘记的参数,这个也自己备忘,如有错误或者引用不当,欢迎指正。
Last modified date: 2019-03-01
caffe总共提供了六种优化方法:
注释的是可以省略的,有默认值, 但是如果要优化,还是要自己调整。
type: "SGD" #default
#momentum: 0.9
type: "AdaDelta"
#momentum: 0.95
#delta: 1e-6
type: "AdaGrad"
type: "Adam"
#momentum: 0.9
#momentum2: 0.999
#delta: 1e-8
#momentum: 0.95
#type: "Nesterov"
type: "RMSProp"
#rms_decay: 0.98
// The learning rate decay policy. The currently implemented learning rate
// policies are as follows:
// - fixed: always return base_lr.
// - step: return base_lr * gamma ^ (floor(iter / step))
// - exp: return base_lr * gamma ^ iter
// - inv: return base_lr * (1 + gamma * iter) ^ (- power)
// - multistep: similar to step but it allows non uniform steps defined by
// stepvalue
// - poly: the effective learning rate follows a polynomial decay, to be
// zero by the max_iter. return base_lr (1 - iter/max_iter) ^ (power)
// - sigmoid: the effective learning rate follows a sigmod decay
// return base_lr ( 1/(1 + exp(-gamma * (iter - stepsize))))
//
// where base_lr, max_iter, gamma, step, stepvalue and power are defined
// in the solver parameter protocol buffer, and iter is the current iteration.
---------------------
作者:cuijyer
来源:CSDN
原文:https://blog.csdn.net/cuijyer/article/details/78195178
版权声明:本文为博主原创文章,转载请附上博文链接!
lr_policy可以设置为下面这些值,相应的学习率的计算为:
base_lr: 0.01
lr_policy: "fixed"
max_iter: 400000
base_lr: 0.01
lr_policy: "step"
gamma: 0.1
stepsize: 30
max_iter: 100
base_lr: 0.01
lr_policy: "exp"
gamma: 0.1
max_iter: 100
base_lr: 0.01
lr_policy: "inv"
gamma: 0.1
power: 0.75
max_iter: 10000
base_lr: 0.01
lr_policy: "multistep"
gamma: 0.5
stepvalue: 1000
stepvalue: 3000
stepvalue: 4000
stepvalue: 4500
stepvalue: 5000
max_iter: 6000
---------------------
作者:cuijyer
来源:CSDN
原文:https://blog.csdn.net/cuijyer/article/details/78195178
版权声明:本文为博主原创文章,转载请附上博文链接!
base_lr: 0.01
lr_policy: "poly"
power: 0.5
max_iter: 10000
base_lr: 0.01
lr_policy: "sigmoid"
gamma: -0.001
stepsize: 5000
max_iter: 10000
分类训练中,solver文件配置共有5个主要部分的参数配置,具体内容如下:
具体的示例如下图所示:
# ------- 1. config net ---------
net: "examples/mnist/lenet_train_test.prototxt"
# ------- 2. config test --------
test_iter: 100
test_interval: 500
# ------ 3. config lr_policy --------
base_lr: 1.0
lr_policy: "fixed"
weight_decay: 0.0005
display: 100
max_iter: 10000
# ------4. config snapshot --------
snapshot: 5000
snapshot_prefix: "examples/mnist/lenet_adadelta"
# ----- 5. config solver type -------
solver_mode: GPU
type: "AdaDelta"
delta: 1e-6
momentum: 0.95
检测训练中,solver文件配置共有6个主要部分的参数配置,具体内容如下:
具体的示例如下图所示:
# -------1. config net ----------
train_net: "example/MobileNetSSD_train.prototxt"
test_net: "example/MobileNetSSD_test.prototxt"
# -------2. config test --------
test_iter: 673
test_interval: 10000
# -------3. config lr_policy ------
base_lr: 0.0005
display: 10
max_iter: 120000
lr_policy: "multistep"
gamma: 0.5
weight_decay: 0.00005
stepvalue: 20000
stepvalue: 40000
# -------4. config snapshot ------
snapshot: 1000
snapshot_prefix: "snapshot/mobilenet"
snapshot_after_train: true
# -------5. config solver -------
solver_mode: GPU
type: "RMSProp"
# -------6. other -------
eval_type: "detection"
ap_version: "11point"
test_initialization: false
debug_info: false
average_loss: 10
iter_size: 1
待后续完善
待后续完善
[1] Caffe学习系列(10):命令行解析 [https://www.cnblogs.com/denny402/p/5076285.html]
[2] Caffe 的深度学习训练全过程 [https://www.infoq.cn/article/whole-process-of-caffe-depth-learning-training]
[3] Caffe学习系列(8):solver优化方法
[https://www.cnblogs.com/denny402/p/5074212.html]
[4] 图示caffe的solver中不同的学习策略(lr_policy) [https://blog.csdn.net/cuijyer/article/details/78195178 ]
[5] 预训练模型 [https://github.com/BVLC/caffe/wiki/Model-Zoo]
[6] Fine-tuning a Pretrained Network for Style Recognition [https://nbviewer.jupyter.org/github/BVLC/caffe/blob/master/examples/02-fine-tuning.ipynb]
[7] http://caffe.berkeleyvision.org/gathered/examples/finetune_flickr_style.html
[8] caffe中fine-tuning模型三重天(函数详解、框架简述)+微调技巧 [https://blog.csdn.net/sinat_26917383/article/details/54999868]
[9] 常见优化算法 (caffe和tensorflow对应参数) [https://blog.csdn.net/csyanbin/article/details/53460627]