How to train VGG model from scratch on my own data without having train_val.prototxt and solver?

8,825 views
Skip to first unread message

Saeed Izadi

unread,
Aug 15, 2015, 11:11:26 AM8/15/15
to Caffe Users
Hi,
I want to train the VGG-16 model on own dataset from scratch, but as I noticed, there is only the deploy.prototxt file available. In other hand, to do so, train_val.prototxt andsolver.prototxt are needed. So, how can I train the model? Can anyone help with providing the required files or suggesting an alternative solution? 
Bests,
-Saeed

Oscar Beijbom

unread,
Aug 15, 2015, 1:50:06 PM8/15/15
to Caffe Users
Hi Saeed,

you basically just need to add the data layers at the top and loss at the bottom. You can check out how this is done by looking at other train_val prototxt's in the repo / caffe website. Or this one that:

http://cs.stanford.edu/people/karpathy/vgg_train_val.prototxt

which is linked to in the comments section of the VGG16 model zoo.


Note that for VGG, you will want to use the channel-wise normalization instead of the mean-image normalization. 

cheers

Saeed Izadi

unread,
Aug 16, 2015, 2:14:39 AM8/16/15
to Caffe Users
Thank you so much, 
What do you mean by channel-wise normalization? you mean that each channel must be mean-normalized separately?

Forrest Iandola

unread,
Sep 9, 2015, 12:28:24 AM9/9/15
to Caffe Users
This train_val.prototxt is missing the details about weight initialization. His did you handle weight initialization for VGG?

Abhijat Biswas

unread,
Jan 6, 2016, 11:53:48 PM1/6/16
to Caffe Users
Weights are in the .caffemodel!

Forrest Iandola

unread,
Jan 24, 2016, 4:21:24 PM1/24/16
to Caffe Users
Those weights are for a pretrained model on ImageNet. Saeed Izadi above wants to train from scratch (and the weights need to be initialized to something, e.g. gaussian noise, or xavier initialization, or something else).

Majid Azimi

unread,
Jan 24, 2016, 7:09:25 PM1/24/16
to Caffe Users
Hi Saeed, 

as @Oscarthis mentioned this is done, just by defining the data layer in the beginning and the loss function in the end. instead of using pretrained VGGNet you can use  another .caffemodel which each layer separately has been initialized by gaussian orxavier. also instead of using mean image normalization for all three channels of images you should use  image normalization for each channel separately.


Cheers,
Majid

kadirk

unread,
Aug 23, 2016, 2:58:29 AM8/23/16
to Caffe Users
There is a working train_val mentioned in this topic: https://github.com/NVIDIA/DIGITS/issues/159
https://github.com/lfrdm/Masterarbeit/blob/master/train_val.prototxt

25 Ocak 2016 Pazartesi 02:09:25 UTC+2 tarihinde Majid Azimi yazdı:

Aaron harlap

unread,
Sep 5, 2017, 10:55:02 AM9/5/17
to Caffe Users, kadir....@gmail.com
Any chance someone could post a working link for the train_val.prototxt, thanks!
Reply all
Reply to author
Forward
0 new messages