how to load reference .caffemodel for training

不想你离开。 提交于 2019-12-24 01:55:13

问题


I'm using alexnet to train my own dataset. The example code in caffe comes with

bvlc_reference_caffenet.caffemodel
solver.prototxt
train_val.prototxt
deploy.prototxt

When I train with the following command:

./build/tools/caffe train --solver=models/bvlc_reference_caffenet/solver.prototxt

I'd like to start with weights given in bvlc_reference.caffenet.caffemodel.

My questions are

  1. How do I do that?

  2. Is it a good idea to start from the those weights? Would this converge faster? Would this be bad if my data are vastly different from the Imagenet dataset?


回答1:


1.
In order to use existing .caffemodel weights for fine-tuning, you need to use --weights command line argument:

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

2.
In most cases fine-tuning a net is quite a recommended practice, even when the input images are quite different than "imagenet" photos.
However, you should note that when training for the original weights you are about to use, some (very reasonable) assumptions were made. You should decide whether these assumptions are still true for your task.
For instance, most nets were trained with simple data augmentation using an image and its horizontal flip. However, if your task is to distinguish between images that are flipped you will find it very difficult to fine tune.



来源:https://stackoverflow.com/questions/43750565/how-to-load-reference-caffemodel-for-training

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!