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


Python make_layers.group_norm方法代码示例

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


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

示例1: __init__

# 需要导入模块: from maskrcnn_benchmark.modeling import make_layers [as 别名]
# 或者: from maskrcnn_benchmark.modeling.make_layers import group_norm [as 别名]
def __init__(
        self,
        in_channels,
        bottleneck_channels,
        out_channels,
        num_groups=1,
        stride_in_1x1=True,
        stride=1,
        dilation=1
    ):
        super(BottleneckWithGN, self).__init__(
            in_channels=in_channels,
            bottleneck_channels=bottleneck_channels,
            out_channels=out_channels,
            num_groups=num_groups,
            stride_in_1x1=stride_in_1x1,
            stride=stride,
            dilation=dilation,
            norm_func=group_norm
        ) 
开发者ID:Res2Net,项目名称:Res2Net-maskrcnn,代码行数:22,代码来源:resnet.py

示例2: __init__

# 需要导入模块: from maskrcnn_benchmark.modeling import make_layers [as 别名]
# 或者: from maskrcnn_benchmark.modeling.make_layers import group_norm [as 别名]
def __init__(
        self,
        in_channels,
        bottleneck_channels,
        out_channels,
        num_groups=1,
        stride_in_1x1=True,
        stride=1,
        dilation=1,
        scale=4
    ):
        super(Bottle2neckWithGN, self).__init__(
            in_channels=in_channels,
            bottleneck_channels=bottleneck_channels,
            out_channels=out_channels,
            num_groups=num_groups,
            stride_in_1x1=stride_in_1x1,
            stride=stride,
            dilation=dilation,
            scale=4,
            norm_func=group_norm
        ) 
开发者ID:Res2Net,项目名称:Res2Net-maskrcnn,代码行数:24,代码来源:res2net.py

示例3: __init__

# 需要导入模块: from maskrcnn_benchmark.modeling import make_layers [as 别名]
# 或者: from maskrcnn_benchmark.modeling.make_layers import group_norm [as 别名]
def __init__(
        self,
        in_channels,
        bottleneck_channels,
        out_channels,
        num_groups=1,
        stride_in_1x1=True,
        stride=1,
        dilation=1,
        dcn_config={}
    ):
        super(BottleneckWithGN, self).__init__(
            in_channels=in_channels,
            bottleneck_channels=bottleneck_channels,
            out_channels=out_channels,
            num_groups=num_groups,
            stride_in_1x1=stride_in_1x1,
            stride=stride,
            dilation=dilation,
            norm_func=group_norm,
            dcn_config=dcn_config
        ) 
开发者ID:simaiden,项目名称:Clothing-Detection,代码行数:24,代码来源:resnet.py

示例4: __init__

# 需要导入模块: from maskrcnn_benchmark.modeling import make_layers [as 别名]
# 或者: from maskrcnn_benchmark.modeling.make_layers import group_norm [as 别名]
def __init__(self, in_channels, out_channels, kernel_size, stride=1, relu=True, same_padding=False, gn=False):
        super(Conv2dGroup, self).__init__()
        padding = int((kernel_size - 1) / 2) if same_padding else 0
        self.conv = nn.Conv2d(in_channels, out_channels, kernel_size, stride, padding=padding)
        self.gn = GN(out_channels) if gn else None # nn.BatchNorm2d(out_channels, eps=0.001, momentum=0, affine=True) if gn else None #
        self.relu = nn.ReLU(inplace=True) if relu else None 
开发者ID:clw5180,项目名称:remote_sensing_object_detection_2019,代码行数:8,代码来源:roi_rec_predictors.py

示例5: __init__

# 需要导入模块: from maskrcnn_benchmark.modeling import make_layers [as 别名]
# 或者: from maskrcnn_benchmark.modeling.make_layers import group_norm [as 别名]
def __init__(self, cfg, in_channels):
        super(FPNXconv1fcFeatureExtractor, self).__init__()

        resolution = cfg.MODEL.ROI_BOX_HEAD.POOLER_RESOLUTION
        scales = cfg.MODEL.ROI_BOX_HEAD.POOLER_SCALES
        sampling_ratio = cfg.MODEL.ROI_BOX_HEAD.POOLER_SAMPLING_RATIO
        pooler = Pooler(
            output_size=(resolution, resolution),
            scales=scales,
            sampling_ratio=sampling_ratio,
        )
        self.pooler = pooler

        use_gn = cfg.MODEL.ROI_BOX_HEAD.USE_GN
        conv_head_dim = cfg.MODEL.ROI_BOX_HEAD.CONV_HEAD_DIM
        num_stacked_convs = cfg.MODEL.ROI_BOX_HEAD.NUM_STACKED_CONVS
        dilation = cfg.MODEL.ROI_BOX_HEAD.DILATION

        xconvs = []
        for ix in range(num_stacked_convs):
            xconvs.append(
                nn.Conv2d(
                    in_channels,
                    conv_head_dim,
                    kernel_size=3,
                    stride=1,
                    padding=dilation,
                    dilation=dilation,
                    bias=False if use_gn else True
                )
            )
            in_channels = conv_head_dim
            if use_gn:
                xconvs.append(group_norm(in_channels))
            xconvs.append(nn.ReLU(inplace=True))

        self.add_module("xconvs", nn.Sequential(*xconvs))
        for modules in [self.xconvs,]:
            for l in modules.modules():
                if isinstance(l, nn.Conv2d):
                    torch.nn.init.normal_(l.weight, std=0.01)
                    if not use_gn:
                        torch.nn.init.constant_(l.bias, 0)

        input_size = conv_head_dim * resolution ** 2
        representation_size = cfg.MODEL.ROI_BOX_HEAD.MLP_HEAD_DIM
        self.fc6 = make_fc(input_size, representation_size, use_gn=False)
        self.out_channels = representation_size 
开发者ID:Res2Net,项目名称:Res2Net-maskrcnn,代码行数:50,代码来源:roi_box_feature_extractors.py


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