Skip to first unread message

Ani Sakhlian

unread,
Feb 2, 2017, 2:34:34 PM2/2/17
to Caffe Users
Hi. I am going to use off-the-shelf pre-trained CNN features to classify different types of food. Using responses from the fully connected layer as features, I have to train linear classifier to perform classification. Could you please explain step by step what I should do. From the beginning. I have read caffe documentation, but I still a little bit confused from where to start and so on.

mohsen zarrindel

unread,
Jun 9, 2017, 5:14:39 AM6/9/17
to Caffe Users
Hello Ani.
I am beginner too. If you find your answer would you please forward here? 

در پنجشنبه 2 فوریهٔ 2017، ساعت 23:04:34 (UTC+3:30)، Ani Sakhlian نوشته:
Message has been deleted

Nathan Ing

unread,
Jun 9, 2017, 7:40:22 PM6/9/17
to Caffe Users
I am assuming you have a labelled dataset, and that your dataset is LMDB. You can easily create LMDB's using the included convert_imageset tool. 

In the net definition .prototxt, there are many blocks like

layer {
  name
: ""
  
... etc ...
  num_output: 1000
}

go to the last fully connected layer one, like you said, and change its name to something else. e.g. `name: "fc_food"`. Also change the `num_output` to the number of classes in your dataset.

I assume you have a solver.prototxt, and know about choosing a solver, learning rate policy, batch sizes, etc. I also assume you have downloaded the pre-trained .caffemodel file. In solver.prototxt you set `snapshot_prefix` to the path you want your model's trained weights to go.

The command to fine-tune using pretrained weights is:
/path/to/caffe/build/tools/caffe train \
--solver ./edited_solver.prototxt \
--weights ./pretrained_weights.caffemodel

That's it in a nut shell. A next step is to use the python interface to obtain great control over your training process, and to save features.
Reply all
Reply to author
Forward
0 new messages