What is `lr_policy` in Caffe?

后端 未结 2 636
日久生厌
日久生厌 2020-12-02 10:44

I just try to find out how I can use Caffe. To do so, I just took a look at the different .prototxt files in the examples folder. There is one option I don\'t u

相关标签:
2条回答
  • 2020-12-02 11:04

    If you look inside the /caffe-master/src/caffe/proto/caffe.proto file (you can find it online here) you will see the following descriptions:

    // 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.
    
    0 讨论(0)
  • 2020-12-02 11:04

    It is a common practice to decrease the learning rate (lr) as the optimization/learning process progresses. However, it is not clear how exactly the learning rate should be decreased as a function of the iteration number.

    If you use DIGITS as an interface to Caffe, you will be able to visually see how the different choices affect the learning rate.

    fixed: the learning rate is kept fixed throughout the learning process.


    inv: the learning rate is decaying as ~1/T
    enter image description here


    step: the learning rate is piecewise constant, dropping every X iterations
    enter image description here


    multistep: piecewise constant at arbitrary intervals
    enter image description here


    You can see exactly how the learning rate is computed in the function SGDSolver<Dtype>::GetLearningRate (solvers/sgd_solver.cpp line ~30).


    Recently, I came across an interesting and unconventional approach to learning-rate tuning: Leslie N. Smith's work "No More Pesky Learning Rate Guessing Games". In his report, Leslie suggests to use lr_policy that alternates between decreasing and increasing the learning rate. His work also suggests how to implement this policy in Caffe.

    0 讨论(0)
提交回复
热议问题