I want to use pretrained ResNext as a image feature extractor for my Faster-RCNN, as described in the tutorial 7.
class ResNextFeatures(nn.Module):
    def __init__(self):
        super(ResNextFeatures, self).__init__()
        base_model = torchvision.models.resnext50_32x4d(pretrained=True)
0
        self.seq1 = nn.Sequential(base_model.conv1, 
                                  base_model.bn1,
                                  base_model.relu,
                                  base_model.maxpool)
        self.seq2 = nn.Sequential(base_model.layer1, 
                                  base_model.layer2,
                                  base_model.layer3,
                                  base_model.layer4)
        
        self.out_channels = 2048
    
    def forward(self, x):
        x = self.seq1(x)
        x = self.seq2(x)

        return x

backbone = ResNextFeatures()
anchor_generator = AnchorGenerator(sizes=((8, 16 , 32, 64, 128, 256),),
                                   aspect_ratios=((0.5, 1.0, 2.0),))
roi_pooler = torchvision.ops.MultiScaleRoIAlign(featmap_names=[0],
                                                output_size=7,
                                                sampling_ratio=2)
model = FasterRCNN(backbone,
                   num_classes=2,
                   rpn_anchor_generator=anchor_generator,
                   box_roi_pool=roi_pooler)

when I pass my input to the model as
loss_dict = model(images, targets)
I am getting an error
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
    548             result = self._slow_forward(*input, **kwargs)
    549         else:
--> 550             result = self.forward(*input, **kwargs)
    551         for hook in self._forward_hooks.values():
    552             hook_result = hook(self, input, result)

/usr/local/lib/python3.6/dist-packages/torchvision/models/detection/generalized_rcnn.py in forward(self, images, targets)
     69             features = OrderedDict([('0', features)])
     70         proposals, proposal_losses = self.rpn(images, features, targets)
---> 71         detections, detector_losses = self.roi_heads(features, proposals, images.image_sizes, targets)
     72         detections = self.transform.postprocess(detections, images.image_sizes, original_image_sizes)
     73 

/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
    548             result = self._slow_forward(*input, **kwargs)
    549         else:
--> 550             result = self.forward(*input, **kwargs)
    551         for hook in self._forward_hooks.values():
    552             hook_result = hook(self, input, result)

/usr/local/lib/python3.6/dist-packages/torchvision/models/detection/roi_heads.py in forward(self, features, proposals, image_shapes, targets)
    752             matched_idxs = None
    753 
--> 754         box_features = self.box_roi_pool(features, proposals, image_shapes)
    755         box_features = self.box_head(box_features)
    756         class_logits, box_regression = self.box_predictor(box_features)

/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
    548             result = self._slow_forward(*input, **kwargs)
    549         else:
--> 550             result = self.forward(*input, **kwargs)
    551         for hook in self._forward_hooks.values():
    552             hook_result = hook(self, input, result)

/usr/local/lib/python3.6/dist-packages/torchvision/ops/poolers.py in forward(self, x, boxes, image_shapes)
    184         rois = self.convert_to_roi_format(boxes)
    185         if self.scales is None:
--> 186             self.setup_scales(x_filtered, image_shapes)
    187 
    188         scales = self.scales

/usr/local/lib/python3.6/dist-packages/torchvision/ops/poolers.py in setup_scales(self, features, image_shapes)
    157         # get the levels in the feature map by leveraging the fact that the network always
    158         # downsamples by a factor of 2 at each level.
--> 159         lvl_min = -torch.log2(torch.tensor(scales[0], dtype=torch.float32)).item()
    160         lvl_max = -torch.log2(torch.tensor(scales[-1], dtype=torch.float32)).item()
    161         self.scales = scales

IndexError: list index out of range