0

How can I use the pretrained e.g. AlexNet model to train a CNN which supports larger (e.g. 500x500) input image sizes?

In other words, how to copy only the convolutional filters to the new network (using Matlab wrapper)?

user570593
  • 3,420
  • 12
  • 56
  • 91
  • even if you copy the weights of the conv layers, you still have to train from scratch the weights for the `"InnerProduct"` layers. – Shai Jul 07 '16 at 14:21
  • 1
    Thats true. I found a way but not sure thats the correct way. I just use the same name for the convolutional layers and used a different name (compared to the alexnet prototxt file) for the FC layers and copied the weights using the solver.net.copy_from(weightsFN);. It seems work. – user570593 Jul 07 '16 at 14:24
  • it's the most straight-forward way. you can post it as an answer. – Shai Jul 07 '16 at 14:26
  • But if I want to copy this for different nets (see http://stackoverflow.com/questions/38226378/how-to-create-this-cnn-architecture-in-caffe?noredirect=1#comment63891207_38226378 ) I am not sure how to do it. – user570593 Jul 07 '16 at 14:26
  • ahh... the duplication part is a bit tricky, if you do not want to link them like in a Siamese network... It can be easily done using python interface. google "caffe net surgery". – Shai Jul 07 '16 at 14:36
  • Thanks alot. I am looking for matlab. Anyway i will go through "Siamese network". – user570593 Jul 07 '16 at 14:38
  • are you fully aware of the difference between initializing the two paths to the same weights, and fixing the weights to be identical? – Shai Jul 07 '16 at 14:40
  • Yes. But not sure in the implementation point of view (how to make the two paths to be identical or different). In my case i would like to initialize with a pretrained model, but the two paths can be identical as well. – user570593 Jul 07 '16 at 14:45
  • But if I want to have two different networks what can i do? – user570593 Jul 07 '16 at 15:03
  • "net surgery" sounds like the easiest way. If you are going to work with caffe, the python interface is much more evolved than the matlab interface. You should not fear learning some python. it's not too difficult. – Shai Jul 07 '16 at 15:14

0 Answers0