Week 2 assignment 2 Transfer Learning

I​ don’t understand how we are able to use Mobilenet for the alpacca dataset eventhough it was trained on imagenet whose images have sizes bigger from those of the alpacca’s. Doesn’t this mean the the flattened array will have a size that doesn’t match the dense layer?

Trained Mobilenet model has learnt a lot of useful features based on the imagenet. Since our input is still an image, we can use mobilenet model and finetune if required. This is better than training a model from scratch.

But shouldn’t we get an error because the matrix for the FC layer won’t match the expected size?

It is a good point that we need to preprocess the images into the form required by the pretrained model. Note that it’s more than just the image size: we also need the pixel values to be normalized to the range [-1,1]. It turns out all that logic is there: search the notebook for the function preprocess_input and watch how it is used.

1 Like