Transfer learning image size

I am following the tutotial for transfer learning

I wish to train on a custom dataset, which cannot be cropped as it will result in relevant data being lost.

224x224 is too small for my use case

Maybe I could resize my data to 480x640

But I would prefer not to alter the images.

When I try to train the model I get an error on size mismatch.
It seems the implementation of the model only allows for images which are 224 x 224.

Is this correct?

Looking at the model

vs the torch versions
There is a single kernel size 7
and single input to AvgPool
Which suggests that the input must be square

In torch


in pytorch
self.conv1 = nn.Conv2d(3, 64, kernel_size=7, stride=2, padding=3,

If I change the torch model to model:add(Convolution(3,64,15,20,2,2,3,3))
It will at least allow me to train with 480*640 images…although it will not allow me to fine tune a pretrained model

So I basically have 3 questions

  1. To train on different image sizes can the pretrained models be used?
  2. Do all images in training have to be the same size (I thought fully convolutional networks would allow any input size …this training works with tensorflow and inception-v3)?
  3. How do I fine tune a model with images which are not 224*224?

You need to modify the size of your last layer after convolutions finish.

Look at one of my earlier posts on this topic for a solution.

Thanks for the pointer.

model.avgpool = nn.AdaptiveAvgPool2d(1)
To get this to work