I want to extract the model till the FPN and not the layers after that (pooling and other things), I am doing the following:
all_children = list(model.backbone.children())
second_child = list(all_children[1].children())[0]
new_children = [all_children[0]] + [second_child]
nn.Sequential(*new_children)

My model is defined as follows:
model = torchvision.models.detection.fasterrcnn_resnet50_fpn(pretrained = pretrained)
num_classes = len(set(cls2idx.values())) + 1
in_features = model.roi_heads.box_predictor.cls_score.in_features
model.roi_heads.box_predictor = FastRCNNPredictor(in_features, num_classes)

When I pass images to my model, I get an error saying forward expects one positional argument but 2 were given. I am only doing model(images). What am I doing wrong?
How do I get the feature maps so that I can use them for another application?