How to get the Feature visualization for pre-trained resnet50 models?

I'm trying to visualize some of the features from a pre-trained resnet50 FasterRCNN. The model downloaded is from torchvision:

torchvision.models.detection.fasterrcnn_resnet50_fpn(pretrained=True)

The examples I've seen use VGG16, which has a much different architecture and can output visualizations of the filters. For the resnet, the layering is a bit different and I can't seem to get any features out. Any ideas on what needs to be tweaked from the simpler VGG example? I'm using this model to feed in images that have annotation text and I'd like to see if the RPN is focusing on the text instead of the annotated areas.

model_children=list(modelVGG.children())
 
for child in model_children:
  if type(child)==nn.Conv2d:
    no_of_layers+=1
    conv_layers.append(child)
  elif type(child)==nn.Sequential:
    for layer in child.children():
      if type(layer)==nn.Conv2d:
        no_of_layers+=1
        conv_layers.append(layer)
print(no_of_layers)

example from:https://androidkt.com/how-to-visualize-feature-maps-in-convolutional-neural-networks-using-pytorch/

Topic faster-rcnn pytorch

Category Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.