mmagic.models.editors.wgan_gp.wgan_gp_module
¶
Module Contents¶
Classes¶
Module used in WGAN-GP to transform 1D noise tensor in order [N, C] to |
|
Module used in WGAN-GP to get the final prediction result with 4x4 |
|
ConvModule with Layer Normalization. |
- class mmagic.models.editors.wgan_gp.wgan_gp_module.WGANNoiseTo2DFeat(noise_size, out_channels, act_cfg=dict(type='ReLU'), norm_cfg=dict(type='BN'), order=('linear', 'act', 'norm'))[source]¶
Bases:
torch.nn.Module
Module used in WGAN-GP to transform 1D noise tensor in order [N, C] to 2D shape feature tensor in order [N, C, H, W].
- Parameters
noise_size (int) – Size of the input noise vector.
out_channels (int) – The channel number of the output feature.
act_cfg (dict, optional) – Config for the activation layer. Defaults to dict(type=’ReLU’).
norm_cfg (dict, optional) – Config dict to build norm layer. Defaults to dict(type=’BN’).
order (tuple, optional) – The order of conv/norm/activation layers. It is a sequence of “conv”, “norm” and “act”. Common examples are (“conv”, “norm”, “act”) and (“act”, “conv”, “norm”). Defaults to (‘linear’, ‘act’, ‘norm’).
- class mmagic.models.editors.wgan_gp.wgan_gp_module.WGANDecisionHead(in_channels, mid_channels, out_channels, bias=True, act_cfg=dict(type='ReLU'), out_act=None, norm_cfg=dict(type='LN2d'))[source]¶
Bases:
torch.nn.Module
Module used in WGAN-GP to get the final prediction result with 4x4 resolution input tensor in the bottom of the discriminator.
- Parameters
in_channels (int) – Number of channels in input feature map.
mid_channels (int) – Number of channels in feature map after convolution.
out_channels (int) – The channel number of the final output layer.
bias (bool, optional) – Whether to use bias parameter. Defaults to True.
act_cfg (dict, optional) – Config for the activation layer. Defaults to dict(type=’ReLU’).
out_act (dict, optional) – Config for the activation layer of output layer. Defaults to None.
norm_cfg (dict, optional) – Config dict to build norm layer. Defaults to dict(type=’LN2d’).
- class mmagic.models.editors.wgan_gp.wgan_gp_module.ConvLNModule(*args, feature_shape=None, **kwargs)[source]¶
Bases:
mmcv.cnn.ConvModule
ConvModule with Layer Normalization.
In this module, we inherit default
mmcv.cnn.ConvModule
and deal with the situation that ‘norm_cfg’ is ‘LN2d’ or ‘GN’. We adopt ‘GN’ as a replacement for layer normalization referring to: https://github.com/LynnHo/DCGAN-LSGAN-WGAN-GP-DRAGAN-Pytorch/blob/master/module.py # noqa- Parameters
feature_shape (tuple) – The shape of feature map that will be.