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


Python layers.ROIAlign方法代码示例

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


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

示例1: __init__

# 需要导入模块: from maskrcnn_benchmark import layers [as 别名]
# 或者: from maskrcnn_benchmark.layers import ROIAlign [as 别名]
def __init__(self, output_size, scales, sampling_ratio):
        """
        Arguments:
            output_size (list[tuple[int]] or list[int]): output size for the pooled region
            scales (list[float]): scales for each Pooler
            sampling_ratio (int): sampling ratio for ROIAlign
        """
        super(Pooler, self).__init__()
        poolers = []
        for scale in scales:
            poolers.append(
                ROIAlign(
                    output_size, spatial_scale=scale, sampling_ratio=sampling_ratio
                )
            )
        self.poolers = nn.ModuleList(poolers)
        self.output_size = output_size
        # get the levels in the feature map by leveraging the fact that the network always
        # downsamples by a factor of 2 at each level.
        lvl_min = -torch.log2(torch.tensor(scales[0], dtype=torch.float32)).item()
        lvl_max = -torch.log2(torch.tensor(scales[-1], dtype=torch.float32)).item()
        self.map_levels = LevelMapper(lvl_min, lvl_max) 
开发者ID:Res2Net,项目名称:Res2Net-maskrcnn,代码行数:24,代码来源:poolers.py

示例2: __init__

# 需要导入模块: from maskrcnn_benchmark import layers [as 别名]
# 或者: from maskrcnn_benchmark.layers import ROIAlign [as 别名]
def __init__(self, output_size, scales):
        """
        Arguments:
            output_size (list[tuple[int]] or list[int]): output size for the pooled region
            scales (list[float]): scales for each Pooler
            sampling_ratio (int): sampling ratio for ROIAlign
        """
        super(PyramidRROIAlign, self).__init__()
        poolers = []
        for scale in scales:
            poolers.append(
                RROIAlign(
                    output_size, spatial_scale=scale
                )
            )
        self.poolers = nn.ModuleList(poolers)
        self.output_size = output_size
        # get the levels in the feature map by leveraging the fact that the network always
        # downsamples by a factor of 2 at each level.
        lvl_min = -torch.log2(torch.tensor(scales[0], dtype=torch.float32)).item()
        lvl_max = -torch.log2(torch.tensor(scales[-1], dtype=torch.float32)).item()
        self.map_levels = LevelMapper(lvl_min, lvl_max) 
开发者ID:clw5180,项目名称:remote_sensing_object_detection_2019,代码行数:24,代码来源:poolers.py

示例3: __init__

# 需要导入模块: from maskrcnn_benchmark import layers [as 别名]
# 或者: from maskrcnn_benchmark.layers import ROIAlign [as 别名]
def __init__(self, output_size, scales, sampling_ratio, drop_last):
        """
        Arguments:
            output_size (list[tuple[int]] or list[int]): output size for the pooled region
            scales (list[flaot]): scales for each Pooler
            sampling_ratio (int): sampling ratio for ROIAlign
            drop_last (bool): if passed, drop the last feature map
        """
        super(Pooler, self).__init__()
        poolers = []
        for scale in scales:
            poolers.append(
                ROIAlign(
                    output_size, spatial_scale=scale, sampling_ratio=sampling_ratio
                )
            )
        self.poolers = nn.ModuleList(poolers)
        self.drop_last = drop_last 
开发者ID:mlperf,项目名称:training_results_v0.5,代码行数:20,代码来源:poolers.py

示例4: __init__

# 需要导入模块: from maskrcnn_benchmark import layers [as 别名]
# 或者: from maskrcnn_benchmark.layers import ROIAlign [as 别名]
def __init__(self, output_size, scales, sampling_ratio, canonical_level=4):
        """
        Arguments:
            output_size (list[tuple[int]] or list[int]): output size for the pooled region
            scales (list[float]): scales for each Pooler
            sampling_ratio (int): sampling ratio for ROIAlign
        """
        super(Pooler, self).__init__()
        poolers = []
        for scale in scales:
            poolers.append(
                ROIAlign(
                    output_size, spatial_scale=scale, sampling_ratio=sampling_ratio
                )
            )
        self.poolers = nn.ModuleList(poolers)
        self.output_size = output_size
        # get the levels in the feature map by leveraging the fact that the network always
        # downsamples by a factor of 2 at each level.
        lvl_min = -torch.log2(torch.tensor(scales[0], dtype=torch.float32)).item()
        lvl_max = -torch.log2(torch.tensor(scales[-1], dtype=torch.float32)).item()
        self.map_levels = LevelMapper(
            lvl_min, lvl_max, canonical_level=canonical_level
        ) 
开发者ID:zhangxiaosong18,项目名称:FreeAnchor,代码行数:26,代码来源:poolers.py

示例5: __init__

# 需要导入模块: from maskrcnn_benchmark import layers [as 别名]
# 或者: from maskrcnn_benchmark.layers import ROIAlign [as 别名]
def __init__(self, output_size, scales, sampling_ratio,
                 level_map='scale', level_map_kwargs=None):    # add by hui
        """
        Arguments:
            output_size (list[tuple[int]] or list[int]): output size for the pooled region
            scales (list[float]): scales for each Pooler
            sampling_ratio (int): sampling ratio for ROIAlign

            # add by hui
            level_map: 'scale' mean origin FPN map;
                    'fixed' will use given 'level_min' and 'level_max' in level_map_kwargs, such as, 2, 5 mean use P2~P5
        """
        super(Pooler, self).__init__()
        poolers = []
        for scale in scales:
            poolers.append(
                ROIAlign(
                    output_size, spatial_scale=scale, sampling_ratio=sampling_ratio
                )
            )
        self.poolers = nn.ModuleList(poolers)
        self.output_size = output_size
        # get the levels in the feature map by leveraging the fact that the network always
        # downsamples by a factor of 2 at each level.
        # ######################## changed by hui ################################################
        if level_map == 'scale':
            lvl_min = -torch.log2(torch.tensor(scales[0], dtype=torch.float32)).item()
            lvl_max = -torch.log2(torch.tensor(scales[-1], dtype=torch.float32)).item()
            self.map_levels = LevelMapper(lvl_min, lvl_max)
        elif level_map == 'fixed':
            lvl_min, lvl_max = level_map_kwargs.LEVEL_MIN, level_map_kwargs.LEVEL_MAX
            self.map_levels = LevelMapper(lvl_min, lvl_max)
        # ######################################################################################### 
开发者ID:ucas-vg,项目名称:TinyBenchmark,代码行数:35,代码来源:poolers.py


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