1

How to load caffemodel weights (alongside with a solver) to use subsequently for retraining using Python?

In other words, what would be the counterpart of the following command line in Pycaffe?

build/tools/caffe train \
-solver models/finetune_flickr_style/solver.prototxt \
-weights models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel 
cerebrou
  • 5,353
  • 15
  • 48
  • 80
  • Possible duplicate of [Cheat sheet for caffe / pycaffe?](http://stackoverflow.com/questions/32379878/cheat-sheet-for-caffe-pycaffe) – Shai Mar 06 '17 at 08:52
  • No. Please note that the proposed duplicate question has no answer to my question. – cerebrou Mar 07 '17 at 02:24
  • it has in its last part – Shai Mar 07 '17 at 04:37
  • "Solver", "Other features"? In neither of the parts, it is explained how to load a caffemodel for retraining. If you see it, please make it into an answer, – cerebrou Mar 07 '17 at 07:13

1 Answers1

5

Loading caffemodel for finetuning with a particular solver can be obtained in Pycaffe by means of get_solver() and net.copy_from() functions:

solver=caffe.get_solver('prototxtfile.prototxt')
solver.net.copy_from('weights.caffemodel')
cerebrou
  • 5,353
  • 15
  • 48
  • 80