I'm a newbie in pytorch and I was trying to put some custom anchors on my Faster RCNN network in pytorch. Basically, I'm using a resnet50 backbone and when I try to put the anchors, I got a mismatch error.
This is the code that I have:
backbone = torchvision.models.detection.backbone_utils.resnet_fpn_backbone('resnet50', True)
backbone.out_channels = 256
anchor_generator = AnchorGenerator(sizes=((4, 8, 16, 32, 64, 128),),
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=10,
rpn_anchor_generator=anchor_generator,
box_roi_pool=roi_pooler)
The error that I got is the following: shape '[1440000, -1]' is invalid for input of size 7674336.