From 18a21d4b07c581a8954b08518115fb035c712b28 Mon Sep 17 00:00:00 2001
From: natanielruiz <nataniel777@hotmail.com>
Date: 星期二, 08 八月 2017 07:34:09 +0800
Subject: [PATCH] Added new correct cropping for training and smoothing for video.

---
 code/utils.py |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/code/utils.py b/code/utils.py
index 645ae19..1e37045 100644
--- a/code/utils.py
+++ b/code/utils.py
@@ -22,8 +22,8 @@
         face_y = tdy - 0.50 * size
     else:
         height, width = img.shape[:2]
-        face_x = width / 2 - 0.15 - size
-        face_y = height / 2 - 0.15 - size
+        face_x = width / 2 - 0.5 * size
+        face_y = height / 2 - 0.5 * size
 
     x1 = size * (cos(y) * cos(r)) + face_x
     y1 = size * (cos(p) * sin(r) + cos(r) * sin(p) * sin(y)) + face_y
@@ -70,5 +70,11 @@
     pose_params = pre_pose_params[:3]
     return pose_params
 
+def get_pt2d_from_mat(mat_path):
+    # Get 2D landmarks
+    mat = sio.loadmat(mat_path)
+    pt2d = mat['pt2d']
+    return pt2d
+
 def mse_loss(input, target):
     return torch.sum(torch.abs(input.data - target.data) ** 2)

--
Gitblit v1.8.0