Skip to content

Faster RCNN / Mask RCNN Backbones

Source

Usage

We use the torchvision Faster RCNN model, and the torchvision Mask RCNN model.

Both models accept a variety of backbones. In following example, we use the default fasterrcnn_resnet50_fpn model. We can also choose one of the many backbones listed here below:

Faster RCNN Backbones Examples

fasterrcnn_resnet50_fpn Example: Source Code

- Using the default argument

model = faster_rcnn.model(num_classes=len(class_map))

Using the explicit backbone definition

backbone = backbones.resnet_fpn.resnet50(pretrained=True) # Default
model = faster_rcnn.model(
    backbone=backbone, num_classes=len(class_map)
)

resnet18 Example:

backbone = backbones.resnet_fpn.resnet18(pretrained=True)
model = faster_rcnn.model(
    backbone=backbone, num_classes=len(class_map)
)

Mask RCNN Backbones Examples

fasterrcnn_resnet50_fpn Example:

- Using the default argument

model = mask_rcnn.model(num_classes=len(class_map))

Using the explicit backbone definition

backbone = backbones.resnet_fpn.resnet50(pretrained=True) # Default
model = mask_rcnn.model(
    backbone=backbone, num_classes=len(class_map)
)

resnet34 Example:

backbone = backbones.resnet_fpn.resnet34(pretrained=True)
model = faster_rcnn.model(
    backbone=backbone, num_classes=len(class_map)
)

Supported Backbones

FPN backbones - resnet18

  • resnet34

  • resnet50

  • resnet101

  • resnet152

  • resnext50_32x4d

  • resnext101_32x8d

  • wide_resnet50_2

  • wide_resnet101_2

Resnet backbone - resnet18

  • resnet34

  • resnet50

  • resnet101

  • resnet152

  • resnext101_32x8d

MobileNet - mobilenet

VGG

  • vgg11

  • vgg13

  • vgg16

  • vgg19