當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。