Create feature map of pretrained resnet50 layers

To visualize the kernels, just get the weight parameter of the specific layer by addressing the attribute and try to plot it e.g. using matplotlib. E.g. if your model has 3 conv layers defined as self.conv1 = nn.Conv2d(...), you could get the kernels via:

model = MyModel()
kernel = model.conv2.weight.detach()

To get activations for a specific input, have a look at this post.