Shortcuts

mmedit.models.editors.dcgan.dcgan_discriminator

Module Contents

Classes

DCGANDiscriminator

Discriminator for DCGAN.

class mmedit.models.editors.dcgan.dcgan_discriminator.DCGANDiscriminator(input_scale, output_scale, out_channels, in_channels=3, base_channels=128, default_norm_cfg=dict(type='BN'), default_act_cfg=dict(type='LeakyReLU'), out_act_cfg=None, pretrained=None)[源代码]

Bases: torch.nn.Module

Discriminator for DCGAN.

Implementation Details for DCGAN 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.

参数
  • input_scale (int) – The scale of the input image.

  • output_scale (int) – The final scale of the convolutional feature.

  • out_channels (int) – The channel number of the final output layer.

  • 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.

  • 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='ReLU').

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

  • pretrained (str, optional) – Path for the pretrained model. Default to None.

forward(x)[源代码]

Forward function.

参数

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

返回

Prediction for the reality of the input image.

返回类型

torch.Tensor

init_weights(pretrained=None)[源代码]

Init weights for models.

We just use the initialization method proposed in the original paper.

参数

pretrained (str, optional) – Path for pretrained weights. If given None, pretrained weights will not be loaded. Defaults to None.

Read the Docs v: latest
Versions
master
latest
stable
zyh-doc-notfound-extend
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.