Closed yongyongdown closed 4 years ago
Hi @aotmc11 , sorry top bother you.
Did you solve this? Would you be able to share your code? I am trying to load a custom image and view the points on it. Thanks!
after passing an image through a face detector model to get the bounding box:
for j, _bbox in enumerate(bounding_boxes):
bounding_boxes[j] = [max(0, int(x)) for x in bounding_boxes[j]]
image_tensor_face = input_tensor[:, bounding_boxes[j][1]: bounding_boxes[j][3], bounding_boxes[j][0]: bounding_boxes[j][2]]
image_tensor_face = image_tensor_face.to(device)
resized_face = torch.nn.functional.interpolate(image_tensor_face.unsqueeze(0), (256, 256))
model_ft.eval()
outputs, boundary_channels = model_ft(resized_face)
from utils.utils import fan_NME, show_landmarks, get_preds_fromhm
pred_heatmap = outputs[-1][:, :-1, :, :][0].detach().cpu()
pred_landmarks, _ = get_preds_fromhm(pred_heatmap.unsqueeze(0))
pred_landmarks = pred_landmarks.squeeze().numpy()
pred_landmarks_4x = pred_landmarks*4
image_tensor_face = resized_face.squeeze(0).cpu().detach()
image_tensor_face_np = (image_tensor_face.numpy().transpose(1, 2, 0)*255).astype(np.uint8)
and then you would use scatter to visualize these landmarks on the face.
hi, thank for your dedicate.
How can I visualize the results using custom test data?