当前位置: 首页>>代码示例>>Python>>正文


Python registry.BACKBONES属性代码示例

本文整理汇总了Python中maskrcnn_benchmark.modeling.registry.BACKBONES属性的典型用法代码示例。如果您正苦于以下问题:Python registry.BACKBONES属性的具体用法?Python registry.BACKBONES怎么用?Python registry.BACKBONES使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在maskrcnn_benchmark.modeling.registry的用法示例。


在下文中一共展示了registry.BACKBONES属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: build_res2net_fpn_p3p7_backbone

# 需要导入模块: from maskrcnn_benchmark.modeling import registry [as 别名]
# 或者: from maskrcnn_benchmark.modeling.registry import BACKBONES [as 别名]
def build_res2net_fpn_p3p7_backbone(cfg):
    body = res2net.Res2Net(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


# def build_backbone(cfg):
#     assert cfg.MODEL.BACKBONE.CONV_BODY in registry.BACKBONES, \
#         "cfg.MODEL.BACKBONE.CONV_BODY: {} are not registered in registry".format(
#             cfg.MODEL.BACKBONE.CONV_BODY
#         )
#     return registry.BACKBONES[cfg.MODEL.BACKBONE.CONV_BODY](cfg) 
开发者ID:Res2Net,项目名称:Res2Net-maskrcnn,代码行数:32,代码来源:res2net_builder.py

示例2: build_backbone

# 需要导入模块: from maskrcnn_benchmark.modeling import registry [as 别名]
# 或者: from maskrcnn_benchmark.modeling.registry import BACKBONES [as 别名]
def build_backbone(cfg):
    assert cfg.MODEL.BACKBONE.CONV_BODY in registry.BACKBONES, \
        "cfg.MODEL.BACKBONE.CONV_BODY: {} are not registered in registry".format(
            cfg.MODEL.BACKBONE.CONV_BODY
        )
    return registry.BACKBONES[cfg.MODEL.BACKBONE.CONV_BODY](cfg) 
开发者ID:Res2Net,项目名称:Res2Net-maskrcnn,代码行数:8,代码来源:backbone.py

示例3: test_build_backbones

# 需要导入模块: from maskrcnn_benchmark.modeling import registry [as 别名]
# 或者: from maskrcnn_benchmark.modeling.registry import BACKBONES [as 别名]
def test_build_backbones(self):
        ''' Make sure backbones run '''

        self.assertGreater(len(registry.BACKBONES), 0)

        for name, backbone_builder in registry.BACKBONES.items():
            print('Testing {}...'.format(name))
            if name in BACKBONE_CFGS:
                cfg = load_config(BACKBONE_CFGS[name])
            else:
                # Use default config if config file is not specified
                cfg = copy.deepcopy(g_cfg)
            backbone = backbone_builder(cfg)

            # make sures the backbone has `out_channels`
            self.assertIsNotNone(
                getattr(backbone, 'out_channels', None),
                'Need to provide out_channels for backbone {}'.format(name)
            )

            N, C_in, H, W = 2, 3, 224, 256
            input = torch.rand([N, C_in, H, W], dtype=torch.float32)
            out = backbone(input)
            for cur_out in out:
                self.assertEqual(
                    cur_out.shape[:2],
                    torch.Size([N, backbone.out_channels])
                ) 
开发者ID:Res2Net,项目名称:Res2Net-maskrcnn,代码行数:30,代码来源:test_backbones.py

示例4: build_backbone

# 需要导入模块: from maskrcnn_benchmark.modeling import registry [as 别名]
# 或者: from maskrcnn_benchmark.modeling.registry import BACKBONES [as 别名]
def build_backbone(cfg):
    """
    For Generalized_RCNN
    """
    assert cfg.MODEL.BACKBONE.CONV_BODY in registry.BACKBONES, \
        "cfg.MODEL.BACKBONE.CONV_BODY: {} are not registered in registry".format(
            cfg.MODEL.BACKBONE.CONV_BODY
        )
    return registry.BACKBONES[cfg.MODEL.BACKBONE.CONV_BODY](cfg) 
开发者ID:Lausannen,项目名称:NAS-FCOS,代码行数:11,代码来源:backbone.py


注:本文中的maskrcnn_benchmark.modeling.registry.BACKBONES属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。