Shortcuts

mmagic.models.editors.lsgan.lsgan_discriminator

Module Contents

Classes

LSGANDiscriminator

Discriminator for LSGAN.

class mmagic.models.editors.lsgan.lsgan_discriminator.LSGANDiscriminator(input_scale=128, output_scale=8, out_channels=1, in_channels=3, base_channels=64, conv_cfg=dict(type='Conv2d'), default_norm_cfg=dict(type='BN'), default_act_cfg=dict(type='LeakyReLU', negative_slope=0.2), out_act_cfg=None, init_cfg=None)[source]

Bases: mmengine.model.BaseModule

Discriminator for LSGAN.

Implementation Details for LSGAN architecture:

  1. Adopt convolution in the discriminator;

  2. Use batchnorm in the discriminator except for the input and final output layer;

  3. Use LeakyReLU in the discriminator in addition to the output layer;

  4. Use fully connected layer in the output layer;

  5. Use 5x5 conv rather than 4x4 conv in DCGAN.

Parameters
  • input_scale (int, optional) – The scale of the input image. Defaults to 128.

  • output_scale (int, optional) – The final scale of the convolutional feature. Defaults to 8.

  • out_channels (int, optional) – The channel number of the final output layer. Defaults to 1.

  • in_channels (int, optional) – The channel number of the input image. Defaults to 3.

  • base_channels (int, optional) – The basic channel number of the generator. The other layers contains channels based on this number. Defaults to 128.

  • conv_cfg (dict, optional) – Config for the convolution module used in this discriminator. Defaults to dict(type=’Conv2d’).

  • default_norm_cfg (dict, optional) – Norm config for all of layers except for the final output layer. Defaults to dict(type='BN').

  • default_act_cfg (dict, optional) – Activation config for all of layers except for the final output layer. Defaults to dict(type='LeakyReLU', negative_slope=0.2).

  • out_act_cfg (dict, optional) – Activation config for the final output layer. Defaults to dict(type='Tanh').

  • init_cfg (dict, optional) – Initialization config dict.

forward(x)[source]

Forward function.

Parameters

x (torch.Tensor) – Fake or real image tensor.

Returns

Prediction for the reality of the input image.

Return type

torch.Tensor

Read the Docs v: latest
Versions
latest
stable
0.x
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.