From 9f2fa4a5fa2af40503c05379c9d5318e87581c7b Mon Sep 17 00:00:00 2001 From: natanielruiz <nataniel777@hotmail.com> Date: 星期五, 08 十二月 2017 02:10:14 +0800 Subject: [PATCH] Removed shape loading which fixes a bug with loading AFLW2000 and 300W-LP for training and testing. --- code/datasets.py | 12 ++---------- 1 files changed, 2 insertions(+), 10 deletions(-) diff --git a/code/datasets.py b/code/datasets.py index 5f1dfdc..8d05d98 100644 --- a/code/datasets.py +++ b/code/datasets.py @@ -96,7 +96,6 @@ img = Image.open(os.path.join(self.data_dir, self.X_train[index] + self.img_ext)) img = img.convert(self.image_mode) mat_path = os.path.join(self.data_dir, self.y_train[index] + self.annot_ext) - shape_path = os.path.join(self.data_dir, self.y_train[index] + '_shape.npy') # Crop the face loosely pt2d = utils.get_pt2d_from_mat(mat_path) @@ -136,11 +135,8 @@ bins = np.array(range(-99, 102, 3)) binned_pose = np.digitize([yaw, pitch, roll], bins) - 1 - # Get shape - shape = np.load(shape_path) - # Get target tensors - labels = torch.LongTensor(np.concatenate((binned_pose, shape), axis = 0)) + labels = binned_pose cont_labels = torch.FloatTensor([yaw, pitch, roll]) if self.transform is not None: @@ -171,7 +167,6 @@ img = Image.open(os.path.join(self.data_dir, self.X_train[index] + self.img_ext)) img = img.convert(self.image_mode) mat_path = os.path.join(self.data_dir, self.y_train[index] + self.annot_ext) - shape_path = os.path.join(self.data_dir, self.y_train[index] + '_shape.npy') # Crop the face loosely pt2d = utils.get_pt2d_from_mat(mat_path) @@ -214,11 +209,8 @@ bins = np.array(range(-99, 102, 3)) binned_pose = np.digitize([yaw, pitch, roll], bins) - 1 - # Get shape - shape = np.load(shape_path) - # Get target tensors - labels = torch.LongTensor(np.concatenate((binned_pose, shape), axis = 0)) + labels = binned_pose cont_labels = torch.FloatTensor([yaw, pitch, roll]) if self.transform is not None: -- Gitblit v1.8.0