Reputation: 23
I have loaded the pre-trained model of vgg19. How to remove the adaptive average pool layer which is present before the classifier?
Upvotes: 2
Views: 700
Reputation: 645
If you are using PyTorch and torchVision model, you can disable the use of the last maxpool layer like this:
nn.Sequential(*list(vgg.features._modules.values())[:-1])
Here all the layers are in an array, and not including the last element does the trick.
Upvotes: 3