fine-tuning with VGG on caffe

ytrewq picture ytrewq · Sep 22, 2015 · Viewed 8.6k times · Source

I'm replicating the steps in http://caffe.berkeleyvision.org/gathered/examples/finetune_flickr_style.html

I want to change the network to VGG model which is obtained at http://www.robots.ox.ac.uk/~vgg/software/very_deep/caffe/VGG_ILSVRC_16_layers.caffemodel

does it suffice to simply substitute the model parameter as following?

./build/tools/caffe train -solver models/finetune_flickr_style/solver.prototxt -weights VGG_ISLVRC_16_layers.caffemodel -gpu 0

Or do I need to adjust learning rates, iterations, i.e. does it come with separate prototxt files?

Answer

ypx picture ypx · Sep 22, 2015

There needs to be a 1-1 correspondence between the weights of the network you want to train and the weights you use for initializing/fine-tuning. The architecture of the old and new model have to match.

VGG-16 has a different architecture than the model described by models/finetune_flickr_style/train_val.prototxt (FlickrStyleCaffeNet). This is the network that the solver will try to optimize. Even if it doesn't crash, the weights you've loaded don't have any meaning in the new network.

The VGG-16 network is described in the deploy.prototxt file on this page in Caffe's Model Zoo.