如何使用 Pycaffe 加载 caffemodel 权重以进行再训练?

How to load caffemodel weights for retraining using Pycaffe?

如何加载 caffemodel 权重(连同求解器)以便随后使用 Python 进行再训练?

换句话说,Pycaffe 中的以下命令行对应的是什么?

build/tools/caffe train \
-solver models/finetune_flickr_style/solver.prototxt \
-weights models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel 

可以在 Pycaffe 中通过 get_solver()net.copy_from() 函数加载用于使用特定求解器进行微调的 caffemodel:

solver=caffe.get_solver('prototxtfile.prototxt')
solver.net.copy_from('weights.caffemodel')