I use resnet50 and change fc layer to classifying, like this:
resnet50.fc = nn.Sequential(
nn.Linear(fc_inputs, 256),
nn.ReLU(),
nn.Dropout(0.4),
nn.Linear(256, num_classes),
nn.LogSoftmax(dim=1)
)
I want to get both outputs and the features of nn.Linear(fc_inputs, 256) when forwarding, it looks like:
features, outputs = resnet50(data)
Thanks for all your supporting. (Sorry for my bad English)