caffe:lr_policy用法

本文详细介绍了多种学习率衰减策略,包括fixed、step、exp、inv、multistep、poly及sigmoid等,并解释了每种策略下学习率的具体计算方式。
  1. // The learning rate decay policy. The currently implemented learning rate  
  2. // policies are as follows:  
  3. //    - fixed: always return base_lr.  
  4. //    - step: return base_lr * gamma ^ (floor(iter / step))  
  5. //    - exp: return base_lr * gamma ^ iter  
  6. //    - inv: return base_lr * (1 + gamma * iter) ^ (- power)  
  7. //    - multistep: similar to step but it allows non uniform steps defined by  
  8. //      stepvalue  
  9. //    - poly: the effective learning rate follows a polynomial decay, to be  
  10. //      zero by the max_iter. return base_lr (1 - iter/max_iter) ^ (power)  
  11. //    - sigmoid: the effective learning rate follows a sigmod decay  
  12. //      return base_lr ( 1/(1 + exp(-gamma * (iter - stepsize))))  
  13. //  
  14. // where base_lr, max_iter, gamma, step, stepvalue and power are defined  
  15. // in the solver parameter protocol buffer, and iter is the current iteration. 

lr_policy可以设置为下面这些值,相应的学习率的计算为:



- fixed:   保持base_lr不变.
- step:    如果设置为step,则还需要设置一个stepsize,  返回 base_lr * gamma ^ (floor(iter / stepsize)),其中iter表示当前的迭代次数
- exp:     返回base_lr * gamma ^ iter, iter为当前迭代次数
- inv:      如果设置为inv,还需要设置一个power, 返回base_lr * (1 + gamma * iter) ^ (- power)
- multistep: 如果设置为multistep,则还需要设置一个stepvalue。这个参数和step很相似,step是均匀等间隔变化,而multistep则是根据                                 stepvalue值变化
- poly:     学习率进行多项式误差, 返回 base_lr (1 - iter/max_iter) ^ (power)
- sigmoid: 学习率进行sigmod衰减,返回 base_lr ( 1/(1 + exp(-gamma * (iter - stepsize))))

/usr/include/c++/10/bits/stl_heap.h(356): here instantiation of "void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare &) [with _RandomAccessIterator=__gnu_cxx::__normal_iterator<std::pair<google::protobuf::io::CodedInputStream::Limit, int> *, std::vector<std::pair<google::protobuf::io::CodedInputStream::Limit, int>, std::allocator<std::pair<google::protobuf::io::CodedInputStream::Limit, int>>>>, _Compare=__gnu_cxx::__ops::_Iter_comp_iter<caffe::BatchReindexLayer<float>::pair_sort_first>]" /usr/include/c++/10/bits/stl_algo.h(1671): here instantiation of "void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator=__gnu_cxx::__normal_iterator<std::pair<google::protobuf::io::CodedInputStream::Limit, int> *, std::vector<std::pair<google::protobuf::io::CodedInputStream::Limit, int>, std::allocator<std::pair<google::protobuf::io::CodedInputStream::Limit, int>>>>, _Compare=__gnu_cxx::__ops::_Iter_comp_iter<caffe::BatchReindexLayer<float>::pair_sort_first>]" /usr/include/c++/10/bits/stl_algo.h(1942): here instantiation of "void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator=__gnu_cxx::__normal_iterator<std::pair<google::protobuf::io::CodedInputStream::Limit, int> *, std::vector<std::pair<google::protobuf::io::CodedInputStream::Limit, int>, std::allocator<std::pair<google::protobuf::io::CodedInputStream::Limit, int>>>>, _Compare=__gnu_cxx::__ops::_Iter_comp_iter<caffe::BatchReindexLayer<float>::pair_sort_first>]" /usr/include/c++/10/bits/stl_algo.h(1958): here instantiation of "void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator=__gnu_cxx::__normal_iterator<std::pair<google::protobuf::io::CodedInputStream::Limit, int> *, std::vector<std::pair<google::protobuf::io::CodedInputStream::Limit, i
03-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值