Inquiry about concept of transfer leaarning

The weights of the first layer would be the same as the pretrained ResNet50 that you are using as you only changing the input size, assuming that you have not done any finetuning or training with target data.

Since the last layer is just declared but not trained yet, it would be initialized with a default weight initializer.
https://discuss.pytorch.org/t/how-are-layer-weights-and-biases-initialized-by-default/1307
If its a linear layer check [this] line 57-64.(https://github.com/pytorch/pytorch/blob/master/torch/nn/modules/linear.py)

You would benefit from pretrained model if learned weights of all three channels have similar distribution. But you still need to train (most likely) all layers with target data.

1 Like