當前位置: 首頁>>代碼示例>>Python>>正文


Python keypoints.heatmaps_to_keypoints方法代碼示例

本文整理匯總了Python中utils.keypoints.heatmaps_to_keypoints方法的典型用法代碼示例。如果您正苦於以下問題:Python keypoints.heatmaps_to_keypoints方法的具體用法?Python keypoints.heatmaps_to_keypoints怎麽用?Python keypoints.heatmaps_to_keypoints使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在utils.keypoints的用法示例。


在下文中一共展示了keypoints.heatmaps_to_keypoints方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: keypoint_results

# 需要導入模塊: from utils import keypoints [as 別名]
# 或者: from utils.keypoints import heatmaps_to_keypoints [as 別名]
def keypoint_results(cls_boxes, pred_heatmaps, ref_boxes):
    num_classes = cfg.MODEL.NUM_CLASSES
    cls_keyps = [[] for _ in range(num_classes)]
    person_idx = keypoint_utils.get_person_class_index()
    xy_preds = keypoint_utils.heatmaps_to_keypoints(pred_heatmaps, ref_boxes)

    # NMS OKS
    if cfg.KRCNN.NMS_OKS:
        keep = keypoint_utils.nms_oks(xy_preds, ref_boxes, 0.3)
        xy_preds = xy_preds[keep, :, :]
        ref_boxes = ref_boxes[keep, :]
        pred_heatmaps = pred_heatmaps[keep, :, :, :]
        cls_boxes[person_idx] = cls_boxes[person_idx][keep, :]

    kps = [xy_preds[i] for i in range(xy_preds.shape[0])]
    cls_keyps[person_idx] = kps
    return cls_keyps 
開發者ID:roytseng-tw,項目名稱:Detectron.pytorch,代碼行數:19,代碼來源:test.py

示例2: keypoint_results_vcoco

# 需要導入模塊: from utils import keypoints [as 別名]
# 或者: from utils.keypoints import heatmaps_to_keypoints [as 別名]
def keypoint_results_vcoco(cls_boxes, pred_heatmaps):
    num_classes = cfg.MODEL.NUM_CLASSES
    cls_keyps = [[] for _ in range(num_classes)]
    person_idx = keypoint_utils.get_person_class_index()
    xy_preds = keypoint_utils.heatmaps_to_keypoints(pred_heatmaps, cls_boxes[person_idx])

    # NMS OKS
    if cfg.KRCNN.NMS_OKS:
        keep = keypoint_utils.nms_oks(xy_preds, cls_boxes[person_idx], 0.3)
        xy_preds = xy_preds[keep, :, :]
        # ref_boxes = ref_boxes[keep, :]
        # pred_heatmaps = pred_heatmaps[keep, :, :, :]
        cls_boxes[person_idx] = cls_boxes[person_idx][keep, :]

    kps = [xy_preds[i] for i in range(xy_preds.shape[0])]
    cls_keyps[person_idx] = kps
    return cls_keyps 
開發者ID:bobwan1995,項目名稱:PMFNet,代碼行數:19,代碼來源:test.py

示例3: keypoint_results

# 需要導入模塊: from utils import keypoints [as 別名]
# 或者: from utils.keypoints import heatmaps_to_keypoints [as 別名]
def keypoint_results(cls_boxes, pred_heatmaps, ref_boxes):
    num_classes = cfg.MODEL.NUM_CLASSES
    cls_keyps = [[] for _ in range(num_classes)]
    person_idx = keypoint_utils.get_person_class_index()

    # handle the tubes
    assert pred_heatmaps.shape[1] % cfg.KRCNN.NUM_KEYPOINTS == 0, \
        'Heatmaps must be 17xT'
    time_dim = pred_heatmaps.shape[1] // cfg.KRCNN.NUM_KEYPOINTS
    assert time_dim == ref_boxes.shape[-1] // 4, 'Same T for boxes and keypoints'
    all_xy_preds = []
    for t in range(time_dim):
        all_xy_preds.append(keypoint_utils.heatmaps_to_keypoints(
            pred_heatmaps[:, t * cfg.KRCNN.NUM_KEYPOINTS:
                          (t + 1) * cfg.KRCNN.NUM_KEYPOINTS, ...],
            ref_boxes[:, t * 4: (t + 1) * 4]))
    xy_preds = np.concatenate(all_xy_preds, axis=-1)

    # NMS OKS
    if cfg.KRCNN.NMS_OKS:
        raise NotImplementedError('Handle tubes')
        keep = keypoint_utils.nms_oks(xy_preds, ref_boxes, 0.3)
        xy_preds = xy_preds[keep, :, :]
        ref_boxes = ref_boxes[keep, :]
        pred_heatmaps = pred_heatmaps[keep, :, :, :]
        cls_boxes[person_idx] = cls_boxes[person_idx][keep, :]

    kps = [xy_preds[i] for i in range(xy_preds.shape[0])]
    cls_keyps[person_idx] = kps
    return cls_keyps 
開發者ID:facebookresearch,項目名稱:DetectAndTrack,代碼行數:32,代碼來源:test.py


注:本文中的utils.keypoints.heatmaps_to_keypoints方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。