Comments (2)
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.
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)
- ModuleNotFoundError: No module named 'torchvision.transforms.functional_tensor' HOT 2
- 一些评价及建议 HOT 1
- inference_realesrgan.py how work on multi-gpu?
- how to add my custom model ? HOT 1
- Free up GPU memory after finishing the image enhance
- finetuning RealESRGAN_x4plus.pth input size issue
- custom dataset size for fine tuning
- Allocate more ram
- Image is too clean
- vulkan-1.dll not found HOT 1
- gt_size: 128
- 怎样将训练过程中的loss函数可视化
- Fail to install basicsr HOT 2
- How to modified the proposed SR to train with y_only input ?
- Mac M3 using only CPU HOT 1
- Does "use_shuffle" actualy works? [spoiler] NOPE! [/spoiler] HOT 5
- Saving models and training states
- Error trying to run in Interference on Colab HOT 3
- Non-square dataset
- 学习率一直不变吗 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from real-esrgan.