Can change pretrained model's weight filter shape?

For example, I loaded pretrained Vgg16 model and want to keep same architecture (BN, maxpool, ReLU etc.) and only change several layer’s filter size (3x3->5x5).
Is this possible? How can I do this?

Thank you.
Son.

You can do that buy you will have to retrain the network or at least fine-tune it, as replaced convolutions won’t have pretrained weights.
To do so, you have to check network’s code and replace those convolution whose kernel is (3,3) by (5,5)

@JuanFMontesinos
Yeah right, that’s what I want to do, to reduce effort.
But don’t know how to do replace the convolution kernel

Hi, I’m having a look at the code and it seems network is dinamically generated.

If you replace kernel_size there, you would replace all the convolutions.

You can look for another implementation in which you can tune all the convolutions statically, however it will be a mess to load pytorch’s pretrained weights.

Regards

EDIT, you may be able to extend the function to arbitrary choose convolution sizes for each layer as network is built here:

if you make make_layers function to accept another parameter you can set them as you want to.