本文整理汇总了Python中core.inference.get_final_preds方法的典型用法代码示例。如果您正苦于以下问题:Python inference.get_final_preds方法的具体用法?Python inference.get_final_preds怎么用?Python inference.get_final_preds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.inference
的用法示例。
在下文中一共展示了inference.get_final_preds方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_keypoints_from_bbox
# 需要导入模块: from core import inference [as 别名]
# 或者: from core.inference import get_final_preds [as 别名]
def get_keypoints_from_bbox(pose_model, image, bbox):
x1,y1,w,h = bbox
bbox_input = []
bbox_input.append([x1, y1, x1+w, y1+h])
inputs, origin_img, center, scale = pre_process(image, bbox_input, scores=1, cfg=cfg)
with torch.no_grad():
# compute output heatmap
inputs = inputs[:,[2,1,0]]
output = pose_model(inputs.cuda())
# compute coordinate
preds, maxvals = get_final_preds(
cfg, output.clone().cpu().numpy(), np.asarray(center), np.asarray(scale))
# (N, 17, 3)
result = np.concatenate((preds, maxvals), -1)
return result
示例2: get_keypoints
# 需要导入模块: from core import inference [as 别名]
# 或者: from core.inference import get_final_preds [as 别名]
def get_keypoints(human_model, pose_model, image, smooth=None):
bboxs, scores = yolo_infrence(image, human_model)
# bbox is coordinate location
inputs, origin_img, center, scale = pre_process(image, bboxs, scores, cfg)
with torch.no_grad():
# compute output heatmap
inputs = inputs[:,[2,1,0]]
output = pose_model(inputs.cuda())
# compute coordinate
preds, maxvals = get_final_preds(
cfg, output.clone().cpu().numpy(), np.asarray(center), np.asarray(scale))
# (N, 17, 3)
result = np.concatenate((preds, maxvals), -1)
return result
示例3: get_keypoints_from_bbox
# 需要导入模块: from core import inference [as 别名]
# 或者: from core.inference import get_final_preds [as 别名]
def get_keypoints_from_bbox(pose_model, image, bbox):
x1,y1,w,h = bbox
bbox_input = []
bbox_input.append([x1, y1, x1+w, y1+h])
inputs, origin_img, center, scale = pre_process(image, bbox_input, scores=1, cfg=config)
with torch.no_grad():
# compute output heatmap
output = pose_model(inputs.cuda())
# compute coordinate
preds, maxvals = get_final_preds(
config, output.clone().cpu().numpy(), np.asarray(center), np.asarray(scale))
# (N, 17, 3)
result = np.concatenate((preds, maxvals), -1)
return result
示例4: get_keypoints
# 需要导入模块: from core import inference [as 别名]
# 或者: from core.inference import get_final_preds [as 别名]
def get_keypoints(human_model, pose_model, image):
bboxs, scores = yolo_infrence(image, human_model)
# bbox is coordinate location
inputs, origin_img, center, scale = pre_process(image, bboxs, scores, config)
with torch.no_grad():
# compute output heatmap
output = pose_model(inputs.cuda())
# compute coordinate
preds, maxvals = get_final_preds(
config, output.clone().cpu().numpy(), np.asarray(center), np.asarray(scale))
# (N, 17, 3)
result = np.concatenate((preds, maxvals), -1)
return result