File “train.py”, line 219, in 
train_one_epoch(model, optimizer, traindata, device, epoch, print_freq=100)
File “/home/ajay/Desktop/ID_CNN/engine.py”, line 30, in train_one_epoch
loss_dict = model(images, targets)
File “/home/ajay/id-env/lib/python3.6/site-packages/torch/nn/modules/module.py”, line 727, in _call_impl
result = self.forward(*input, **kwargs)
File “/home/ajay/id-env/lib/python3.6/site-packages/torchvision/models/detection/generalized_rcnn.py”, line 100, in forward
detections, detector_losses = self.roi_heads(features, proposals, images.image_sizes, targets)
File “/home/ajay/id-env/lib/python3.6/site-packages/torch/nn/modules/module.py”, line 727, in _call_impl
result = self.forward(*input, **kwargs)
File “/home/ajay/id-env/lib/python3.6/site-packages/torchvision/models/detection/roi_heads.py”, line 752, in forward
box_features = self.box_roi_pool(features, proposals, image_shapes)
File “/home/ajay/id-env/lib/python3.6/site-packages/torch/nn/modules/module.py”, line 727, in _call_impl
result = self.forward(*input, **kwargs)
File “/home/ajay/id-env/lib/python3.6/site-packages/torchvision/ops/poolers.py”, line 207, in forward
self.setup_scales(x_filtered, image_shapes)
File “/home/ajay/id-env/lib/python3.6/site-packages/torchvision/ops/poolers.py”, line 173, in setup_scales
scales = [self.infer_scale(feat, original_input_shape) for feat in features]
File “/home/ajay/id-env/lib/python3.6/site-packages/torchvision/ops/poolers.py”, line 173, in 
scales = [self.infer_scale(feat, original_input_shape) for feat in features]
File “/home/ajay/id-env/lib/python3.6/site-packages/torchvision/ops/poolers.py”, line 157, in infer_scale
assert possible_scales[0] == possible_scales[1]
The code is working for vgg backbone but while using resnet backbone I get assertion error.
anchor_generator = AnchorGenerator(sizes=((32, 64, 128, 256),), aspect_ratios=((0.5,1.0),))
roi_pooler = torchvision.ops.MultiScaleRoIAlign(featmap_names=[‘0’], output_size=7, sampling_ratio=2)
For vgg -  output_channels=512, resnet_18 - output_channels=512, model = FasterRCNN(backbone, num_classes=num_classes, rpn_anchor_generator= anchor_generator, box_roi_pool=roi_pooler)