修改resnet最后的全连接层输出大小:
resnet = torchvision.models.resnet18(pretrained=True) for param in resnet.parameters(): param.requires_grad = False. #冻结所有层 resnet.fc =nn.Linear(resnet.fc.in_features,100)。#修改fc层的输出size为100
修改resnet最后的全连接层输出大小:
resnet = torchvision.models.resnet18(pretrained=True) for param in resnet.parameters(): param.requires_grad = False. #冻结所有层 resnet.fc =nn.Linear(resnet.fc.in_features,100)。#修改fc层的输出size为100