caffe 学习日记
#**
caffe 加载pretrain model进行finetuning的一些技巧
**
对于caffe finetuning的使用可以参考官网教程:http://caffe.berkeleyvision.org/gathered/examples/finetune_flickr_style.html。
对于一个网络结构,如果我们有它在一些大数据集(比如imagenet等)上训练好的模型,则我们可以将之作为pretrained model加载进来,然后再在我们自己的数据集上继续训练,即finetuning。调用方式如下:
CAFFE_root/build/tool/caffe train -solver solver.prototxt
-weights pretrained.caffemodel
If we provide the weights argument to the caffe train command, the pretrained weights will be loaded into our model, matching layers by name.
加载进来的pretrained model 是根据命名来匹配的,也就是说你的prototxt文件的网络结构命名要跟pretrained model的一样,而那些命名不一样的层就是你想finetuning的层。一般finetuning 最后的FC 层比较常见,因为不同任务或者不同数据集需要调整分类数以及loss定义等。
参考文章:
1、https://www.cnblogs.com/deeeplearnxl/p/6233672.html
2、https://blog.csdn.net/nongfu_spring/article/details/51514040