Can we change the input size of a pretrained network for transfer learning

19 views (last 30 days)
I want to use transfer learning on the Resnet-50 architecture trained on Imagenet. I noticed that the input size into the Resnet-50 architecture is [224 224 3]. However my images are [150 150 3]. I was wondering if there were a way to change the input size of the input layer rather than resizing my images.
  4 Comments
Robert Jansen
Robert Jansen on 24 Aug 2020
None of these answers the original question which is again if there "were a way to change the input size of the input layer rather than resizing my images." i.e. can we change resnet50 to accept (unaltered) a different size image? Everyones answer is to resample the input. The question was explicitely not that! Pehaps the answer is no.
Pakize
Pakize on 26 Dec 2021
I have a same question. As far as I understand, we can only resize the images, but not change the input layer as we change the output layers.

Sign in to comment.

Answers (1)

BERGHOUT Tarek
BERGHOUT Tarek on 16 Apr 2019
yes this methode is cold:
1- if you are changing the neumber of neurons from N to n where N>n: this is called :'constructive' learning
2- if you are changing the neumber of neurons from N to n where N<n: this is called :'distructive' learning
but retraining alwayse requeired , not from the begining but from the final weights that u have in final net
if you want to found some papaers in this area use this key words :
neural networks with additive hidden nodes ; distructive neural nets .....etc. good luck.
  2 Comments
Lenin Falconi
Lenin Falconi on 16 Apr 2019
I am having a hard time understanding your answer. Sure that is something new to me about constructive and distructive learning.
However, it seems like Arjun Desai wants to change the input layer of Resnet 50 so that he can test transfer learning on his/her images. As far as I understand, since Resnet 50 is trained with specific natural image dataset with the dimensions 224x224x3, I don't think the input layer could be changed because this would affect all internal dimensions of the ConvNet arquitecture.
Because of that I aided with a code to simply change image size.
About retraining, not from the beginning I agree totally with you. That's what should happen with transfer, but in order to that happen The image of interest must go forward through the ConvNet until it reaches the las Full Connecting Layers to start retraining or a pertinent node in case of fine tuning. But again image should be in the dimensions expressed by the architecture.
Time ago I found a paper that proposed an arquitecture to deal with images from different sizes. If I found it I will share the name....

Sign in to comment.

Products


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!