Skip to content
fn

mask_rcnn_resnet50_fpn

→MaskRCNNForObjectDetection
mask_rcnn_resnet50_fpn(pretrained: bool | str = False, weights: MaskRCNNResNet50FPNWeights | None = None, overrides: object = {})

Mask R-CNN with a ResNet-50-FPN backbone (COCO-pretrained).

Builds the reference maskrcnn_resnet50_fpn detector: Faster R-CNN's ResNet-50 backbone with frozen batch-norm, a 5-level Feature Pyramid Network (P2-P5 + a parameter-free pool level for RPN), anchors at sizes ((32,),(64,),(128,),(256,),(512,)) and ratios (0.5, 1.0, 2.0), a Fast R-CNN box head (TwoMLPHead + FastRCNNPredictor) over MultiScale RoI Align (7×7), and a parallel mask branch (MaskRCNNHeads + MaskRCNNPredictor) over MultiScale RoI Align (14×14) emitting 28×28 per-class masks. COCO box AP 37.9 / mask AP 34.6, ~44.4M parameters.

Model Size

Parameters

pretrainedbool or str= False
Pretrained-weight selector. False → random init; True → the DEFAULT tag (MaskRCNNResNet50FPNWeights.COCO_V1); a tag string → that specific checkpoint. Mutually exclusive with weights (which wins if both are given).
weights(MaskRCNNResNet50FPNWeights, optional, keyword - only)= None
Explicit weights enum member. Takes precedence over pretrained.
**overridesobject= {}
Keyword overrides forwarded into MaskRCNNConfig.

Returns

MaskRCNNForObjectDetection

Detector with the ResNet-50-FPN configuration applied (or with overrides merged on top of it).

Notes

Pretrained weights are converted from the reference MaskRCNN_ResNet50_FPN_Weights.COCO_V1 checkpoint and hosted under lucid-dl/mask-rcnn-resnet-50-fpn. The detector expects an already resized + normalised image batch (the lucid.utils.transforms.Detection preset).

Examples

>>> import lucid
>>> from lucid.models.vision.mask_rcnn import mask_rcnn_resnet50_fpn
>>> model = mask_rcnn_resnet50_fpn().eval()
>>> out = model(lucid.randn(1, 3, 224, 224))
>>> out.pred_masks.shape[-2:]
(28, 28)

Used by 1