Previously, when using the pre-trained ResNet model for migration training, we fixed the weights of the previous layers in addition to the last layer, and then changed the output of the fully-connected layer to the number that we needed for the last layer, so now if we want to just change the
The output of the last layer is changed so that it doesn't need to be loaded with the weights of the previous layers, as follows:
model = .resnet18(pretrained=False) num_fc_ftr = .in_features = (num_fc_ftr, 224) model = (model, device_ids=).to(device)
First the model structure is mandatory to pass in, then change the output of the last layer to the number you need
The above knowledge is very simple, you can test it, thanks for reading and supporting me.