I want to override forward method of GeneralizedRCNN. I want to return losses and features from ROI head during training. I have tried doing:
model = torchvision.models.detection.fasterrcnn_resnet50_fpn(True).cuda()
model.forward = forward_modified(self,images, targets=None)

It doesn’t work quite well (throws an error from transform). Can someone share a working snippet of efficiently going about it ?