Transfer Learning

Hello,
I am working on implementing and optimizing transfer learning for image classification, eventually using a custom dataset. My current goal is to get the code finished to where I am freezing the layers of a pre-trained model and then only training on the last fully connected layer/classifier using my own dataset. My dataset consists of a folder containing images of 12 “classes” (car, plane, person, etc) and a csv file mapping the names of the aforementioned images to their respective class numbers (car is class 0, plane is class 1, etc). Any advice?

Specifically:
(1) Which pre-trained model would you recommend that I use?
(2) What general steps do I need to take to load in this pre-trained model?
(3) How do I freeze the layers of this pre-trained model and transfer the findings of that model (i.e. weights) to a fully connected layer? (output of pre-trained model to be input of fully connected layer which is where I am doing the training using my own dataset)
(4) How can I get the training then running only on my last fully connected layer/classifier (by classifier I mean image classifier)?
Thanks!

From previous experience, I have the following resources if you would like to take a look please message me (I’m not allowed to publish these on public repo):
A VGG-16 (image) classifier that implements K-folds (k=10) and uses my own dataset mentioned above.
A simple image classifier that uses my own dataset mentioned above.

I also have access to the following which I am having a very hard time understanding:
A transfer learning example (not for image classification) that freezes LSTM and trains on last linear layer using open source data set.

1 Like