deepak112 / Keras-SRGAN

Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network implemented in Keras
276 stars 146 forks source link

A kind request for the code implementation for SRResNet #40

Open BassantTolba1234 opened 3 years ago

BassantTolba1234 commented 3 years ago

Please all, I need the code of implementation this part the part is

{The SRResNet networks were trained with a learning rate of 10−4 and 106 update iterations. We employed the trained MSE-based SRResNet network as initialization for the generator when training the actual GAN to avoid undesired local optima.{

neilthefrobot commented 3 years ago

To successfully train SRGan you must start it out with an already trained SRResNet. Otherwise you will see your generator/discriminator losses very high and stuck in a local minima right off the start. The network will still end up being able to improve image quality, but it will be only from the VGG loss and the GAN part will be basically useless. The fix is extremely easy. In "get_gan_network" change the compilation to be

gan = Model(gan_input, x) 
gan.compile(loss='mse', optimizer=optimizer)

and in the training loop just comment out the training of the discriminator. This trains the generator to minimize the MSE between the training inputs and the training targets with no GAN. Once this model is trained, removed these changes and continue training (using VGG perceptual loss + GAN loss and training the descriminator in the training loop)