I think that you are missing this @ser17 :
roi_pooler = torchvision.ops.MultiScaleRoIAlign(featmap_names=['0'],
                                              output_size=7,
                                              sampling_ratio=2)

mask_roi_pooler = torchvision.ops.MultiScaleRoIAlign(featmap_names=['0'],
                                                              output_size=14,
                                                              sampling_ratio=2)

model = MaskRCNN(backbone,
                          num_classes=2,
                         rpn_anchor_generator=anchor_generator,
                          box_roi_pool=roi_pooler,
                          mask_roi_pool=mask_roi_pooler)