Sorry if my questions are stupid. I am a beginner.
I have a few questions, maybe a few very basic questions…
I see in the transfer learning tutorial we are using :
model_ft = models.resnet18(pretrained=True)
num_ftrs = model_ft.fc.in_features
model_ft.fc = nn.Linear(512, 2)
-
Are we fine tuning the layer with 512 filters?
If not, what should I do to fine tune both last layer and the fully connected layer before that, which has 512 filters -
How I can change the number 512, meaning: if I want to finetune the network in a way that num_ftrs change to 100, what should I do? Is that even possible?
I receive an error when I do ``model_ft.fc = nn.Linear(100, 2)` .
Here is the error: RuntimeError: size mismatch, m1: [4 x 512], m2: [100 x 2] at /pytorch/torch/lib/TH/generic/THTensorMath.c:1293 -
My last question is that if I wanna finetune a network that has more than one fully connected net, what should I do? e.g. Lets say I want to finetune vgg and I wanna finetune the last two fc layers.
Thank you a lot in advance