daa233 / generative-inpainting-pytorch

A PyTorch reimplementation for paper Generative Image Inpainting with Contextual Attention (https://arxiv.org/abs/1801.07892)
MIT License
472 stars 97 forks source link

What is the meaning of this parameter n_critic? #32

Closed Utopiaaaaaaa closed 4 years ago

Utopiaaaaaaa commented 4 years ago

Why is it necessary to calculate the loss of the generator every five times instead of calculating it every time image

daa233 commented 4 years ago

Q: What is the meaning of this parameter n_critic? A: It means 'the number of iterations of the critic (discriminator) per generator iteration'. It was originally proposed by the WGAN paper, and the WGAN-GP paper (which is used in this repo) follows this practice.

Q: Why is it necessary to calculate the loss of the generator every five times instead of calculating it every time? A: Because with WGAN-series loss, we can (and should) train the critic till optimality. It means training the critic more will get better results. However, training the critic more will slow down the convergence. That's why the hyperparameter n_critic is 5 here.

Utopiaaaaaaa commented 4 years ago

Thank you very much for the quick response! Can you add me on WeChat? I still have some questions about the code, the QR code has been sent to your Gmail email(from you github homepage). Thank you for your work, it is very helpful.

daa233 commented 4 years ago

Sorry, I don't like answer questions about the code on WeChat. You can ask here or by email.