jtchen0528/PCL-I2G

Would you give me an advice of 'masks' of input images?

Opened this issue · 1 comments

I have trained a model, named 'PCL-I2G-FF256-32frames-Modified-5e-5'. When I run the test.py with this setting below:

/public/user/anaconda3/envs/PCL-I2G/bin/python3.7 test.py --which_epoch bestval --gpu_ids 0 --partition test --average_mode after_softmax --topn 100 --force_redo --dataset_name FF-DF --real_im_path /data-x/g16/user/outputdir/original/test/ --fake_im_path /data-x/g16/user/outputdir/F2F/test/ --train_config /public/user/PCL-I2G/checkpoints_back/PCL-I2G-FF256-32frames-Modified-5e-5/opt.yml --checkpoints_dir /public/user/PCL-I2G/checkpoints_back/

an error is reported. It looks like I need a mask as an input for testing images.

Traceback (most recent call last):
  File "test.py", line 257, in <module>
    run_eval(opt, output_dir)
  File "test.py", line 62, in run_eval
    model.set_input(inputs)
  File "/public/user/PCL-I2G/models/patch_inconsistency_discriminator_model.py", line 66, in set_input
    self.masks = input['masks'].to(self.device)
KeyError: 'masks'

Would you tell me how to get the mask of testing images? Thanks.

Hi @graydove,

Forgive me, I forgot to push the correct version of the model for testing.

The error is triggered when line 65 in models/patch_inconsistency_discriminator_model.py is asking for masks (for 4D volume loss calculation diring training time). When testing, there is no need for masks, only faces are required, so test.py only gives model ['ims'] and ['labels'].

My way to solve this is: modify set_input() function in line 63 in models/patch_inconsistency_discriminator_model.py, set an argument (such as with_mask=False) so that we can control the model to take masks or not. Then, set the argument in line 62 in test.py to take only images and labels. This should solve the problem.

I am currently serving my military service in Taiwan. I am replying with my phone only. Sorry for the formatting and no direct link to the files on GitHub.

Good luck!