Hi, I want to get outputs from multiple layers of a pretrained VGG-19 network. I have already done that with this approach, that I found on this board:
class AlexNetConv4(nn.Module):
def __init__(self):
super(AlexNetConv4, self).__init__()
self.features = nn.Sequential(
# stop at conv4
*list(original_model.features.children())[:-3]
)
def forward(self, x):
x = self.features(x)
return x
Initializing a new net for every output I am interested in, occupies a lot space on my GPU, therefore I would like to follow this approach, via the forward method:
def forward(self, x):
out1 = F.relu(self.conv1(x))
out2 = F.relu(self.conv2(out1))
out3 = F.relu(self.conv3(out2))
return out1, out2, out3
The problem is, that I don’t know how to get the names of the convolutions in a pretrained VGG-Net that I got from the torch vision models.
Hope someone can help me out with that!