Giter VIP home page Giter VIP logo

Comments (2)

thtskaran avatar thtskaran commented on June 13, 2024

Here's what you need to know about changing the discriminator to PatchGAN in Real-ESRGAN:

Modifications:
Model Definition: You need to modify the discriminator architecture in realesrgan/archs/discriminator_arch.py. Replace the existing UNetDiscriminatorSN with a PatchGAN discriminator architecture. You can refer to implementations in other repositories like pix2pixHD or CycleGAN.

Loss Function: Update the cri_gan loss function in realesrgan/models/realesrgan_model.py to be compatible with PatchGAN. PatchGAN typically uses a least squares GAN loss, so you might need to replace the existing GANLoss with MSELoss.
Training Script: If the training script relies on specific outputs from the discriminator (e.g., for logging or visualization), you might need to adjust it to handle the PatchGAN output format.

Retraining:
Yes, you need to retrain the model after modifying the discriminator. The new architecture will have different parameters and require optimization. You can use the existing training scripts and options, but be aware that the training dynamics might change with the new discriminator.

Improving Discriminative Ability:
Several strategies can improve the discriminative ability of the PatchGAN discriminator:
Increase Network Capacity: Add more layers or filters to the discriminator network, allowing it to learn more complex features.
Use Conditional GANs: If applicable, provide additional information (e.g., class labels) as input to the discriminator, helping it focus on specific aspects of the data.

Loss Function Tuning: Experiment with different loss functions or adjust the loss weights to find the best balance between generator and discriminator training.
Training Strategies: Techniques like spectral normalization or gradient penalty can help stabilize training and improve the discriminator's performance.

Additional Notes:
It's crucial to carefully consider the PatchGAN architecture you choose and its compatibility with the Real-ESRGAN framework.
Monitor the training process closely to ensure the model converges and the discriminator effectively guides the generator.
Compare the performance of the PatchGAN-based model with the original Real-ESRGAN model to assess the impact of the change.
Remember that modifying the discriminator architecture is a significant change that requires careful implementation and retraining.

from real-esrgan.

JeffreyYANGS avatar JeffreyYANGS commented on June 13, 2024

Thank you very much for your answer. Regarding modifying the discriminator, I have already made changes in the model definition part, but I did not modify the loss function part. When I execute the training, it shows that there is an issue with the registerer, as the newly named Patch GAN cannot be correctly registered into the registerer. How can I fix this problem? Afterwards, I will try to make modifications according to your suggestions. I hope to keep in touch with you. Once again, thank you for your answers and your help.

from real-esrgan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.