caffe icon indicating copy to clipboard operation
caffe copied to clipboard

Allow pycaffe to update solver parameters, e.g., learning rate and momentum

Open PiranjaF opened this issue 11 years ago • 7 comments

Many SGD schedules specify that the learning rate should be annealed when validation accuracy has somewhat converged. Similarly, momentum should be around 0.5 in the beginning (http://ufldl.stanford.edu/tutorial/supervised/OptimizationStochasticGradientDescent/) and then to 0.9 when learning is stabilized.

Can these parameters be changed during training from the Python interface? Having this as an option seems like an obvious enhancement.

PiranjaF avatar Jul 03 '15 15:07 PiranjaF

I could really use this in my code as well.

samuelgoodell avatar Jul 07 '15 01:07 samuelgoodell

This is certainly worth doing and only requires minor coding to make the hyperparams for SGDSolver mutable and exposed through boost::python.

As a hack this can be done by running the solver through gdb -- not that I'm really suggesting that.

shelhamer avatar Jul 07 '15 13:07 shelhamer

@shelhamer a much simpler hack would be to train with an initial set of parameters and than change the parameters and fine tune on each step of parameter change.

talda avatar Jul 08 '15 12:07 talda

@talda Would you mind sharing an example of how to change any of the hyperparameters (e.g., the learning rate) using PyCaffe? I tried inspecting the solver objects, but I couldn't find the variable that stores that parameter. Thank you!

pgrossmann avatar Aug 03 '15 17:08 pgrossmann

For solution, see http://stackoverflow.com/questions/31823898/changing-the-solver-parameters-in-caffe-through-pycaffe

ravi-june avatar Mar 01 '16 16:03 ravi-june

+1 on allowing one to change the learning rate and other parameters.

mitar avatar Oct 28 '17 20:10 mitar

i want to finetune a pretrained model which trained with pycaffe
are there any tutorial can help me please ??

hala3 avatar Feb 01 '19 10:02 hala3