From a55f2031127082652c23f1decbb3ffaf79e8ed76 Mon Sep 17 00:00:00 2001 From: Deconimus Date: Thu, 10 Sep 2020 19:06:18 +0200 Subject: [PATCH] clean up --- demo.py | 8 +++++--- face_decoder.py | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/demo.py b/demo.py index 65964cb..f60742c 100644 --- a/demo.py +++ b/demo.py @@ -1,7 +1,10 @@ import tensorflow as tf import numpy as np from PIL import Image -import os, glob, cv2, platform +import os +import glob +import cv2 +import platform from scipy.io import loadmat,savemat from preprocess_img import Preprocess @@ -77,12 +80,11 @@ def demo(): face_texture_ = np.squeeze(face_texture_, (0)) face_color_ = np.squeeze(face_color_, (0)) landmarks_2d_ = np.squeeze(landmarks_2d_, (0)) - recon_img_ = None if not is_windows: recon_img_ = np.squeeze(recon_img_, (0)) # save output files - if recon_img_: + if not is_windows: savemat(os.path.join(save_path,file.split(os.path.sep)[-1].replace('.png','.mat').replace('jpg','mat')),{'cropped_img':input_img[:,:,::-1],'recon_img':recon_img_,'coeff':coeff_,\ 'face_shape':face_shape_,'face_texture':face_texture_,'face_color':face_color_,'lm_68p':landmarks_2d_,'lm_5p':lm_new}) save_obj(os.path.join(save_path,file.split(os.path.sep)[-1].replace('.png','_mesh.obj').replace('jpg','_mesh.obj')),face_shape_,tri_,np.clip(face_color_,0,255)/255) # 3D reconstruction face (in canonical view) diff --git a/face_decoder.py b/face_decoder.py index 8c76536..fab62bc 100644 --- a/face_decoder.py +++ b/face_decoder.py @@ -2,7 +2,7 @@ import tensorflow as tf import math as m import numpy as np from scipy.io import loadmat -import platform, PIL +import platform is_windows = platform.system() == "Windows" @@ -301,7 +301,6 @@ class Face3D(): far_clip = far_clip) return img else: - #return PIL.Image.new('RGB', (224, 224)) return np.zeros([224, 224], dtype=np.int32)