eladrich / pixel2style2pixel

Official Implementation for "Encoding in Style: a StyleGAN Encoder for Image-to-Image Translation" (CVPR 2021) presenting the pixel2style2pixel (pSp) framework
https://eladrich.github.io/pixel2style2pixel/
MIT License
3.19k stars 570 forks source link

number of log images #180

Closed betterze closed 3 years ago

betterze commented 3 years ago

Dear PSP encoder team,

Thank you for sharing this great work, it performs really well.

Is there a well to control number of log images? If I just want o show the test images progress for a few images (maybe 10), instead of the whole test set, is there a way to do this?

Currently, 'image_interval' control the train images interval, 'val_interval' control the test images interval. But for each interval, it uses a lot of images, and it always use too much disk space, I can not even open the folder.

Thank you for your help.

Best Wishes,

Alex

yuval-alaluf commented 3 years ago

I haven't tried this myself, but this should be simple to add. Notice that the logging during validation occurs here: https://github.com/eladrich/pixel2style2pixel/blob/3e2ebd82bb3e3719507898f365abcec16597061a/training/coach.py#L140-L142 And the images are saved for each batch. Therefore, you can add a parameter for logging (for example opts.val_image_interval) and then do something like

if batch_idx % self.opts.val_image_interval == 0:
    self.parse_and_log_images(id_logs, x, y, y_hat, 
                              title='images/test/faces', subscript='{:04d}'.format(batch_idx))

If I am not mistaken, this will save an image every val_image_interval batches.

betterze commented 3 years ago

Thx a lot, I will try it.