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


Python keypoints.get_person_class_index方法代码示例

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


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

示例1: keypoint_results

# 需要导入模块: from utils import keypoints [as 别名]
# 或者: from utils.keypoints import get_person_class_index [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 get_person_class_index [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 get_person_class_index [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.get_person_class_index方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。