本文整理匯總了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