Custom pretrained model with fastai

Here is an example on how to modify fastai to use custom pretrained network. This notebook is defining a pretrained network with VGG16. The default vgg16 in fastai “cuts” all the fully connected layers. In this example we keep all layers but the last one. I have a very small dataset so my intention is to train the last two fully connected layer. First we train the last layer by itself since it is randomly initialized. After that we finetune the last two fully connected layers. Note that most functions assume that we are woking with this network. This is done on purpose so that it easier to understand.

Let me know if you have any questions or if you find any bugs. (-:


Thanks but the above link doesn’t work anymore?

Hi Mark,
I deleted this notebook because I have not been keeping up with updates from But you can find it in the history of this repo.

Here is a version of how to do it in Pytorch.