Shortcuts

mmagic.models.editors.singan.singan_discriminator

Module Contents

Classes

SinGANMultiScaleDiscriminator

Multi-Scale Discriminator used in SinGAN.

class mmagic.models.editors.singan.singan_discriminator.SinGANMultiScaleDiscriminator(in_channels, num_scales, kernel_size=3, padding=0, num_layers=5, base_channels=32, min_feat_channels=32, init_cfg=None, **kwargs)[source]

Bases: mmengine.model.BaseModule

Multi-Scale Discriminator used in SinGAN.

More details can be found in: Singan: Learning a Generative Model from a Single Natural Image, ICCV’19.

Parameters
  • in_channels (int) – Input channels.

  • num_scales (int) – The number of scales/stages in generator. Note that this number is counted from zero, which is the same as the original paper.

  • kernel_size (int, optional) – Kernel size, same as nn.Conv2d. Defaults to 3.

  • padding (int, optional) – Padding for the convolutional layer, same as nn.Conv2d. Defaults to 0.

  • num_layers (int, optional) – The number of convolutional layers in each generator block. Defaults to 5.

  • base_channels (int, optional) – The basic channels for convolutional layers in the generator block. Defaults to 32.

  • min_feat_channels (int, optional) – Minimum channels for the feature maps in the generator block. Defaults to 32.

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

forward(x, curr_scale)[source]

Forward function.

Parameters
  • x (Tensor) – Input feature map.

  • curr_scale (int) – Current scale for discriminator. If in testing, you need to set it to the last scale.

Returns

Discriminative results.

Return type

Tensor

check_and_load_prev_weight(curr_scale)[source]
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.