mmagic.models.editors.esrgan.esrgan
¶
Module Contents¶
Classes¶
Enhanced SRGAN model for single image super-resolution. |
- class mmagic.models.editors.esrgan.esrgan.ESRGAN(generator, discriminator=None, gan_loss=None, pixel_loss=None, perceptual_loss=None, train_cfg=None, test_cfg=None, init_cfg=None, data_preprocessor=None)[source]¶
Bases:
mmagic.models.editors.srgan.SRGAN
Enhanced SRGAN model for single image super-resolution.
Ref: ESRGAN: Enhanced Super-Resolution Generative Adversarial Networks. It uses RaGAN for GAN updates: The relativistic discriminator: a key element missing from standard GAN.
- Parameters
generator (dict) – Config for the generator.
discriminator (dict) – Config for the discriminator. Default: None.
gan_loss (dict) – Config for the gan loss. Note that the loss weight in gan loss is only for the generator.
pixel_loss (dict) – Config for the pixel loss. Default: None.
perceptual_loss (dict) – Config for the perceptual loss. Default: None.
train_cfg (dict) – Config for training. Default: None. You may change the training of gan by setting: disc_steps: how many discriminator updates after one generate update; disc_init_steps: how many discriminator updates at the start of the training. These two keys are useful when training with WGAN.
test_cfg (dict) – Config for testing. Default: None.
init_cfg (dict, optional) – The weight initialized config for
BaseModule
. Default: None.
- g_step(batch_outputs: torch.Tensor, batch_gt_data: torch.Tensor)[source]¶
G step of GAN: Calculate losses of generator.
- Parameters
batch_outputs (Tensor) – Batch output of generator.
batch_gt_data (Tensor) – Batch GT data.
- Returns
Dict of losses.
- Return type
dict