csyxwei / FFWM

Learning Flow-based Feature Warping for Face Frontalization with Illumination Inconsistent Supervision (ECCV 2020).
MIT License
127 stars 23 forks source link

error in test lfw datasets??? #6

Closed Shelomith closed 2 years ago

Shelomith commented 2 years ago

Hi, i've try to test it on flw datasets. but I got this error: The GPUs you are using: 0 Starting to load images via multiple imreaders 100%|████████████████████████████████████████████████████████████████████████████████████| 30/30 [00:00<00:00, 138884.24it/s] dataset [FaceDataset(test)] was created The number of test images = 30 loading the model from ./checkpoints/lightCNN_10_checkpoint.pth model [FFWMModel] was created loading the model from ./checkpoints/ffwm/latest_net_netG.pth loading the model from ./checkpoints/ffwm/latest_net_flowNetF.pth ---------- Networks initialized ------------- [Network netG] Total number of parameters : 16.245 M [Network flowNetF] Total number of parameters : 52.357 M

/home/shelomith/anaconda3/envs/ffwn/lib/python3.7/site-packages/torch/nn/functional.py:3226: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details. warnings.warn("Default grid_sample and affine_grid behavior has changed " Traceback (most recent call last): File "test_ffwm.py", line 77, in model.test(return_fea=False) File "/home/shelomith/facerotator/FFWM/models/ffwm_model.py", line 193, in test self.test_forward() File "/home/shelomith/facerotator/FFWM/models/ffwm_model.py", line 187, in testforward , _, self.fake_F128, att = self.netG(self.img_S, flow=[flow_F32, flow_F64, flow_F128], return_att=True) File "/home/shelomith/anaconda3/envs/ffwn/lib/python3.7/site-packages/torch/nn/modules/module.py", line 550, in call result = self.forward(*input, **kwargs) File "/home/shelomith/facerotator/FFWM/models/base_networks.py", line 339, in forward res_in = torch.cat((skip, dec), 1) RuntimeError: Sizes of tensors must match except in dimension 2. Got 62 and 64

Any one know the reason?

csyxwei commented 2 years ago

Hi,

You can check if your input image resolution is 128x128. It may be caused the input size is not a power of 2.

Shelomith commented 2 years ago

Thanks for your nice reply. After changed the image resolution to 128*128, I solve this error.

I've test 30 pic in FLW datasets by pretrained module. but the results looks not so good. Aaron_Eckhart_0001_fake_F128 Aaron_Eckhart_0001_img_F

Aaron_Patterson_0001_fake_F128 Aaron_Patterson_0001_img_F

Are they reasonable outputs? What's the reason? I'd like to know the performance of this work in "in-the-wild" photo... any suggestion?

csyxwei commented 2 years ago

Hi,

You should align the images firstly. Or you can download the aligned lfw images from GoogleDrive or BaiduNetDisk (l98p).

Shelomith commented 2 years ago

ah, Thanks. I download the dataset wrongly. Aligned dataset performs excellent!

I notice that you use FACE++ to align the face data. Can I use other alignment tools instead of it? like Dlib? is there any requirement when align the face?

csyxwei commented 2 years ago

Hi,

You can also use the dlib to extract the 68 landmarks and then use them to align images. When you aligning the images, you should:

  1. Rotating the face to make the center of two eyes to be horizontal.
  2. Using the bridge of the nose as crop center, and the distance from it to the chin as the radius to crop the face.
  3. Resize the cropped image to 128x128.