Fine-tuning Alexnet on a very different dataset

402 views
Skip to first unread message

Mar S

unread,
Nov 18, 2016, 7:00:06 PM11/18/16
to Caffe Users
I would like to fine-tune Alexnet on my own dataset. My dataset is big enough but it's very different that Imagenet. Therefore, I need to do fine-tuning on a large number of layers. I know that I should change the name of the last FC layer so that it can start learning from scratch for classification and not loading the pre-trained weights from Alexnet. What about other layers? Should I just change the learning rate to the larger rates? Can you please help me I feel lost.!? Thanks.

Jonathan R. Williford

unread,
Nov 19, 2016, 10:10:11 AM11/19/16
to Mar S, Caffe Users
Usually you would just train the last FC layer. Are you sure you need to train the other layers? I would try fine-tuning the fewest layers as possible. First the last FC layer, the last two FC layers, etc.

Jonathan

On Sat, Nov 19, 2016 at 1:00 AM, Mar S <ma.s...@gmail.com> wrote:
I would like to fine-tune Alexnet on my own dataset. My dataset is big enough but it's very different that Imagenet. Therefore, I need to do fine-tuning on a large number of layers. I know that I should change the name of the last FC layer so that it can start learning from scratch for classification and not loading the pre-trained weights from Alexnet. What about other layers? Should I just change the learning rate to the larger rates? Can you please help me I feel lost.!? Thanks.

--
You received this message because you are subscribed to the Google Groups "Caffe Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to caffe-users+unsubscribe@googlegroups.com.
To post to this group, send email to caffe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/caffe-users/c155e100-fe29-46fb-9d73-944f1cd22027%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mar S

unread,
Dec 1, 2016, 6:14:08 PM12/1/16
to Caffe Users, ma.s...@gmail.com
I changed the last layer's name and also number of  the output. Should I also change the lr_mult and decay_mult (learning rates)?


On Saturday, November 19, 2016 at 10:10:11 AM UTC-5, Jonathan R. Williford wrote:
Usually you would just train the last FC layer. Are you sure you need to train the other layers? I would try fine-tuning the fewest layers as possible. First the last FC layer, the last two FC layers, etc.

Jonathan
On Sat, Nov 19, 2016 at 1:00 AM, Mar S <ma.s...@gmail.com> wrote:
I would like to fine-tune Alexnet on my own dataset. My dataset is big enough but it's very different that Imagenet. Therefore, I need to do fine-tuning on a large number of layers. I know that I should change the name of the last FC layer so that it can start learning from scratch for classification and not loading the pre-trained weights from Alexnet. What about other layers? Should I just change the learning rate to the larger rates? Can you please help me I feel lost.!? Thanks.

--
You received this message because you are subscribed to the Google Groups "Caffe Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to caffe-users...@googlegroups.com.

Przemek D

unread,
Dec 16, 2016, 5:26:49 AM12/16/16
to Caffe Users
In my early work I did some comparison between fine-tuning only the last layer, all FC layers and the whole network. Turned out that the more layers I froze (lr_mult: 0.0), the worse performance I got. So go ahead and experiment, but nowadays when I'm training from a pretrained model I always do all layers. I only rename and reinitialize the classification layer, having it learn from scratch, but I let other layers' weights change too.
If you changed layer name and num_output you should be good to go already - lr and decay can stay the same but of course you could try increasing them.
Message has been deleted

Jaya

unread,
Jun 14, 2017, 3:51:18 AM6/14/17
to Caffe Users
Can you please tell me how to change the lr_mult and decay_mult of the copied layers to change their weights and bias values and also for renamed layers.
Thanks!
Reply all
Reply to author
Forward
0 new messages