mmagic.models.editors.dic.light_cnn
¶
Module Contents¶
Classes¶
LightCNN discriminator with input size 128 x 128. |
|
Conv2d or Linear layer with max feature selector. |
- class mmagic.models.editors.dic.light_cnn.LightCNN(in_channels)[source]¶
Bases:
mmengine.model.BaseModule
LightCNN discriminator with input size 128 x 128.
It is used to train DICGAN.
- Parameters
in_channels (int) – Channel number of inputs.
- forward(x)[source]¶
Forward function.
- Parameters
x (Tensor) – Input tensor.
- Returns
Forward results.
- Return type
Tensor
- init_weights(pretrained=None, strict=True)[source]¶
Init weights for models.
- Parameters
pretrained (str, optional) – Path for pretrained weights. If given None, pretrained weights will not be loaded. Defaults to None.
strict (boo, optional) – Whether strictly load the pretrained model. Defaults to True.
- class mmagic.models.editors.dic.light_cnn.MaxFeature(in_channels, out_channels, kernel_size=3, stride=1, padding=1, filter_type='conv2d')[source]¶
Bases:
torch.nn.Module
Conv2d or Linear layer with max feature selector.
- Generate feature maps with double channels, split them and select the max
feature.
- Parameters
in_channels (int) – Channel number of inputs.
out_channels (int) – Channel number of outputs.
kernel_size (int or tuple) – Size of the convolving kernel.
stride (int or tuple, optional) – Stride of the convolution. Default: 1
padding (int or tuple, optional) – Zero-padding added to both sides of the input. Default: 1
filter_type (str) – Type of filter. Options are ‘conv2d’ and ‘linear’. Default: ‘conv2d’.