Where is the discriminator of the GAN, that can be used to find images of lower quality
- User
Where is the discriminator of the GAN, that can be used to find images of lower quality
Assistant
Based on the repository content, the discriminator architecture can be found in
discriminator_arch.pywhich defines theUNetDiscriminatorSNclass. This is a U-Net based discriminator with spectral normalization that is used to distinguish between real (high-quality) and fake (lower-quality) images.The key components of the discriminator are:
-
A U-Net architecture with:
- Downsampling path (conv0-conv3)
- Upsampling path (conv4-conv6)
- Skip connections
- Final convolutions (conv7-conv9)
-
The discriminator takes an image input and outputs a score/map indicating whether each region is real or fake. A lower score indicates lower quality.
-
The discriminator is used during training in
realesrgan_model.pywhere:- It tries to correctly classify real (high-quality) images with high scores
- It tries to classify generated (potentially lower quality) images with low scores
- This is shown in the optimize_parameters() method where:
python
# real real_d_pred = self.net_d(gan_gt) # fake fake_d_pred = self.net_d(self.output.detach())
So while the discriminator can technically identify lower quality images by giving them lower scores, it's primarily designed as a training component rather than a standalone quality assessment tool. The pre-trained discriminator models are available in the model zoo under names like
RealESRGAN_x4plus_netD.pth.-
- User
If I want to use the discriminator of the ESRGAN to act as a classification model that will classify images as blurry or not blurry, how do i do it? How can I use the weights of the discriminator
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.