Looking at the code again, the transform is already defined in the FasterRCNN from which M-RCNN inherits. As you suggested, you only need to provide the right image_mean and image_std when instantiating maskrcnn_resnet50_fpn ( image_mean = [0.485, 0.456,0.406] and image_std = [0.229, 0.224, 0.225]).
You can see that the transform is declared here 32 and used here 25.

You can see it when printing the network:
MaskRCNN(
  (transform): GeneralizedRCNNTransform()
  [...]


We pass masks of size HxW (where H is the height of the image and W is the width of the image). There is no information about the bbox in the mask. MaskRCNN applies a RoIAlign to the full mask during the target sampling phase to get the actual RoI mask.