mmagic.models.editors.eg3d.dual_discriminator
¶
Module Contents¶
Classes¶
Dual Discriminator for EG3D. DualDiscriminator shares the same network |
- class mmagic.models.editors.eg3d.dual_discriminator.DualDiscriminator(img_channels: int = 3, use_dual_disc: bool = True, disc_c_noise: float = 0, *args, **kwargs)[source]¶
Bases:
mmagic.models.editors.stylegan2.StyleGAN2Discriminator
Dual Discriminator for EG3D. DualDiscriminator shares the same network structure with StyleGAN2’s Discriminator. However, DualDiscriminator take volume rendered low-resolution image and super-resolved image at the same time. The LR image will be upsampled and concatenate with SR ones, and then feed to the discriminator together.
- Parameters
img_channels (int) – The number of the image channels. Defaults to 3.
use_dual_disc (bool) – Whether use dual discriminator as EG3D. If True, the input channel of the first conv block will be set as 2 * img_channels. Defaults to True.
disc_c_noise (float) – The factor of noise’s standard deviation add to conditional input before passed to mapping network. Defaults to 0.
*args – Arguments for StyleGAN2Discriminator.
**kwargs –
Arguments for StyleGAN2Discriminator.
- forward(img: torch.Tensor, img_raw: Optional[torch.Tensor] = None, cond: Optional[torch.Tensor] = None)[source]¶
Forward function.
- Parameters
img (torch.Tensor) – Input high resoluation image tensor.
img_raw (torch.Tensor) – Input raw (low resolution) image tensor. Defaults to None.
cond (torch.Tensor) – The conditional input (camera-to-world matrix and intrinsics matrix). Defaults to None.
- Returns
Predict score for the input image.
- Return type
torch.Tensor