Hello everyone,
I am new to torchvision and want to change the number of in_features for the fully-connected layer at the end of a resnet18:
resnet18 = torchvision.models.resnet18(pretrained=False)
resnet18.fc.in_features = 256
I want to do so as I want to use the CNN as a feature extractor, i.e. I want to generate a 256-dimensional embedding for each image.
When changing the code as outlined above, I receive no error. I want to train from scratch, so pretrained models are irrelevant for me.
However, I wonder whether my thoughts are plausible and the implementation is correct? The change in the code seems too small as the number of in_features should depend on the number of channels which depend on the number and type of filters, which I am not adjusting?
Best,
always