本文整理汇总了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
示例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
示例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