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