def build_senet_libra_backbone(cfg): body = senet.build_senet(cfg) in_channels_stage2 = cfg.MODEL.SENET.RES2_OUT_CHANNELS out_channels = cfg.MODEL.SENET.BACKBONE_OUT_CHANNELS fpn = pan_module.FPN( in_channels_list=[ in_channels_stage2, in_channels_stage2 * 2, in_channels_stage2 * 4, in_channels_stage2 * 8, ], out_channels=out_channels, conv_block=conv_with_kaiming_uniform(cfg.MODEL.PAN.USE_GN, cfg.MODEL.FPN.USE_RELU), top_blocks=fpn_module.LastLevelMaxPool(), ) bfp = bfp_module.BFP( in_channels=out_channels, num_levels=cfg.MODEL.LIBRA.NUM_LEVELS, refine_level=cfg.MODEL.LIBRA.REFINE_LEVEL, refine_type=cfg.MODEL.LIBRA.REFINE_TYPE, ) model = nn.Sequential( OrderedDict([("body", body), ("fpn", fpn), ("bfp", bfp)])) model.out_channels = out_channels return model
def build_resnet_pan_backbone(cfg): body = resnet.ResNet(cfg) in_channels_stage2 = cfg.MODEL.RESNETS.RES2_OUT_CHANNELS out_channels = cfg.MODEL.RESNETS.BACKBONE_OUT_CHANNELS pan = pan_module.PAN( in_channels_list=[ in_channels_stage2, in_channels_stage2 * 2, in_channels_stage2 * 4, in_channels_stage2 * 8, ], out_channels=out_channels, conv_block=conv_with_kaiming_uniform(cfg.MODEL.PAN.USE_GN, cfg.MODEL.FPN.USE_RELU), top_blocks=fpn_module.LastLevelMaxPool(), ) model = nn.Sequential(OrderedDict([("body", body), ("pan", pan)])) model.out_channels = out_channels return model
def build_senet_fpn_backbone(cfg): body = senet.build_senet(cfg) in_channels_stage2 = cfg.MODEL.SENET.RES2_OUT_CHANNELS out_channels = cfg.MODEL.SENET.BACKBONE_OUT_CHANNELS fpn = fpn_module.FPN( in_channels_list=[ in_channels_stage2, in_channels_stage2 * 2, in_channels_stage2 * 4, in_channels_stage2 * 8, ], out_channels=out_channels, conv_block=conv_with_kaiming_uniform(cfg.MODEL.FPN.USE_GN, cfg.MODEL.FPN.USE_RELU), top_blocks=fpn_module.LastLevelMaxPool(), ) model = nn.Sequential(OrderedDict([("body", body), ("fpn", fpn)])) model.out_channels = out_channels return model
def build_resnet_fpn_p3p7_backbone(cfg): body = resnet.ResNet(cfg) in_channels_stage2 = cfg.MODEL.RESNETS.RES2_OUT_CHANNELS out_channels = cfg.MODEL.RESNETS.BACKBONE_OUT_CHANNELS in_channels_p6p7 = in_channels_stage2 * 8 if cfg.MODEL.RETINANET.USE_C5 \ else out_channels fpn = fpn_module.FPN( in_channels_list=[ 0, in_channels_stage2 * 2, in_channels_stage2 * 4, in_channels_stage2 * 8, ], out_channels=out_channels, conv_block=conv_with_kaiming_uniform(cfg.MODEL.FPN.USE_GN, cfg.MODEL.FPN.USE_RELU), top_blocks=fpn_module.LastLevelP6P7(in_channels_p6p7, out_channels), ) model = nn.Sequential(OrderedDict([("body", body), ("fpn", fpn)])) model.out_channels = out_channels return model