Caffe: How to initialize a network using .caffemodel, .solverstate? Thank you.

Created on 30 Jun 2017  路  6Comments  路  Source: BVLC/caffe

Could any please show me how to initialize a deep network using .caffemodel or .solverstate?

Thanks
Ayesha

Most helpful comment

In your train.py, you can use solver.net.copy_from(pretrained_model) to restore a trained model and solver.restore(previous_state) to restore previous solver state.

You can find an example here : https://github.com/rbgirshick/py-faster-rcnn/blob/master/lib/fast_rcnn/train.py

Hope it helps
Cheers

All 6 comments

Hello @ayeshasGithub

To resume from a snapshot :
caffe train -gpu all -solver my_model/solver.prototxt -snapshot my_model/my_model_iter_6000.solverstate 2>&1 | tee log/my_model.log

To use weights of a trained model

caffe train -gpu all -solver my_model/solver.prototxt -weights my_model/bvlc_reference_caffenet.caffemodel 2>&1 | tee -a log/my_model.log

Hope it helps
cheers

Thanks so much amal, but I need those commands in python. Do you know how I can do it in python?

In your train.py, you can use solver.net.copy_from(pretrained_model) to restore a trained model and solver.restore(previous_state) to restore previous solver state.

You can find an example here : https://github.com/rbgirshick/py-faster-rcnn/blob/master/lib/fast_rcnn/train.py

Hope it helps
Cheers

Nice of you amal, thank you so much, that definitely should help, thanks a lot

Hello,

Do I need to keep the same old learning rate in solver file while resuming the training via snapshot or I need to change the base_lr where it had left of?

Cheers

Please use the caffe-users list for usage, installation, or modeling questions, or other requests for help.
You may also post questions on stackoverflow, make sure you tag them with caffe tag.
There is also caffe.help documenting the different layers of caffe.
Do not post such requests to Issues. Doing so interferes with the development of Caffe.

Please read the guidelines for contributing before submitting this issue.

Was this page helpful?
0 / 5 - 0 ratings