Shortcuts

mmedit.models.editors.singan.singan_discriminator

Module Contents

Classes

SinGANMultiScaleDiscriminator

Multi-Scale Discriminator used in SinGAN.

class mmedit.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, **kwargs)[源代码]

Bases: torch.nn.Module

Multi-Scale Discriminator used in SinGAN.

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

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

forward(x, curr_scale)[源代码]

Forward function.

参数
  • x (Tensor) – Input feature map.

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

返回

Discriminative results.

返回类型

Tensor

check_and_load_prev_weight(curr_scale)[源代码]
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.