mmagic.models.losses.feature_loss
¶
Module Contents¶
Classes¶
Feature of LightCNN. |
|
Feature loss of DICGAN, based on LightCNN. |
- class mmagic.models.losses.feature_loss.LightCNNFeature[source]¶
Bases:
torch.nn.Module
Feature of LightCNN.
It is used to train DICGAN.
- forward(x: torch.Tensor) torch.Tensor [source]¶
Forward function.
- Parameters
x (Tensor) – Input tensor.
- Returns
Forward results.
- Return type
Tensor
- init_weights(pretrained: Optional[str] = None, strict: bool = True) None [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.losses.feature_loss.LightCNNFeatureLoss(pretrained: str, loss_weight: float = 1.0, criterion: str = 'l1')[source]¶
Bases:
torch.nn.Module
Feature loss of DICGAN, based on LightCNN.
- Parameters
pretrained (str) – Path for pretrained weights.
loss_weight (float) – Loss weight. Default: 1.0.
criterion (str) – Criterion type. Options are ‘l1’ and ‘mse’. Default: ‘l1’.