mask_rcnn(pretrained: bool | str = False, weights: MaskRCNNResNet50FPNWeights | None = None, overrides: object = {})Mask R-CNN with a ResNet-50-FPN backbone (He et al., ICCV 2017).
Alias of mask_rcnn_resnet50_fpn — the canonical reference
configuration: Faster R-CNN's ResNet-50 trunk (frozen BN) + Feature
Pyramid Network + Region Proposal Network + Fast R-CNN box head, plus
a parallel FCN mask branch. The COCO config uses num_classes = 91.
Reaches COCO box AP 37.9 / mask AP 34.6 (reference
maskrcnn_resnet50_fpn).
Model Size
Parameters
pretrainedbool or str= FalsePretrained-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).Explicit weights enum member. Takes precedence over
pretrained.**overridesobject= {}Keyword overrides forwarded into
MaskRCNNConfig
(num_classes, rpn_pre_nms_top_n, score_thresh, ...).Returns
MaskRCNNForObjectDetectionDetector with the ResNet-50-FPN configuration applied (or with
overrides merged on top of it).
Examples
>>> import lucid
>>> from lucid.models.vision.mask_rcnn import mask_rcnn
>>> model = mask_rcnn(num_classes=91)
>>> model.eval()
>>> x = lucid.randn(1, 3, 224, 224)
>>> out = model(x)
>>> out.pred_masks.shape[-2:]
(28, 28)