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


Python boxes.boxes_area方法代码示例

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


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

示例1: map_rois_to_fpn_levels

# 需要导入模块: from utils import boxes [as 别名]
# 或者: from utils.boxes import boxes_area [as 别名]
def map_rois_to_fpn_levels(rois, k_min, k_max):
    """Determine which FPN level each RoI in a set of RoIs should map to based
    on the heuristic in the FPN paper.
    """
    # Compute level ids
    areas, neg_idx = box_utils.boxes_area(rois)
    areas[neg_idx] = 0  # np.sqrt will remove the entries with negative value
    s = np.sqrt(areas)
    s0 = cfg.FPN.ROI_CANONICAL_SCALE  # default: 224
    lvl0 = cfg.FPN.ROI_CANONICAL_LEVEL  # default: 4

    # Eqn.(1) in FPN paper
    target_lvls = np.floor(lvl0 + np.log2(s / s0 + 1e-6))
    target_lvls = np.clip(target_lvls, k_min, k_max)

    # Mark to discard negative area roi. See utils.fpn.add_multilevel_roi_blobs
    # target_lvls[neg_idx] = -1
    return target_lvls 
开发者ID:roytseng-tw,项目名称:Detectron.pytorch,代码行数:20,代码来源:fpn.py

示例2: combine_heatmaps_size_dep

# 需要导入模块: from utils import boxes [as 别名]
# 或者: from utils.boxes import boxes_area [as 别名]
def combine_heatmaps_size_dep(hms_ts, ds_ts, us_ts, boxes, heur_f):
    """Combines heatmaps while taking object sizes into account."""
    assert len(hms_ts) == len(ds_ts) and len(ds_ts) == len(us_ts), \
        'All sets of hms must be tagged with downscaling and upscaling flags'

    # Classify objects into small+medium and large based on their box areas
    areas = box_utils.boxes_area(boxes)
    sm_objs = areas < cfg.TEST.KPS_AUG.AREA_TH
    l_objs = areas >= cfg.TEST.KPS_AUG.AREA_TH

    # Combine heatmaps computed under different transformations for each object
    hms_c = np.zeros_like(hms_ts[0])

    for i in range(hms_c.shape[0]):
        hms_to_combine = []
        for hms_t, ds_t, us_t in zip(hms_ts, ds_ts, us_ts):
            # Discard downscaling predictions for small and medium objects
            if sm_objs[i] and ds_t:
                continue
            # Discard upscaling predictions for large objects
            if l_objs[i] and us_t:
                continue
            hms_to_combine.append(hms_t[i])
        hms_c[i] = heur_f(hms_to_combine)

    return hms_c 
开发者ID:roytseng-tw,项目名称:Detectron.pytorch,代码行数:28,代码来源:test.py

示例3: map_rois_to_fpn_levels

# 需要导入模块: from utils import boxes [as 别名]
# 或者: from utils.boxes import boxes_area [as 别名]
def map_rois_to_fpn_levels(rois, k_min, k_max):
    """Determine which FPN level each RoI in a set of RoIs should map to based
    on the heuristic in the FPN paper.
    """
    # Compute level ids
    s = np.sqrt(box_utils.boxes_area(rois))
    s0 = cfg.FPN.ROI_CANONICAL_SCALE  # default: 224
    lvl0 = cfg.FPN.ROI_CANONICAL_LEVEL  # default: 4

    # Eqn.(1) in FPN paper
    target_lvls = np.floor(lvl0 + np.log2(s / s0 + 1e-6))
    target_lvls = np.clip(target_lvls, k_min, k_max)
    return target_lvls 
开发者ID:ronghanghu,项目名称:seg_every_thing,代码行数:15,代码来源:FPN.py

示例4: map_rois_to_fpn_levels

# 需要导入模块: from utils import boxes [as 别名]
# 或者: from utils.boxes import boxes_area [as 别名]
def map_rois_to_fpn_levels(rois, k_min, k_max):
    # Compute level ids
    s = np.sqrt(box_utils.boxes_area(rois))
    s0 = cfg.FPN.ROI_CANONICAL_SCALE  # default: 224
    lvl0 = cfg.FPN.ROI_CANONICAL_LEVEL  # default: 4

    lvls = np.floor(lvl0 + np.log2(s / s0 + 1e-6))  # Eqn.(1) in FPN paper
    lvls = np.clip(lvls, k_min, k_max)
    # lvls is a list of length len(rois) with a ID from k_min to k_max, as to
    # where it maps to. This might lead to some levels from k_min to k_max not
    # getting any rois mapped to them.
    return lvls 
开发者ID:facebookresearch,项目名称:DetectAndTrack,代码行数:14,代码来源:FPN.py


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