Shortcuts

mmedit.models.losses.feature_loss

Module Contents

Classes

LightCNNFeature

Feature of LightCNN.

LightCNNFeatureLoss

Feature loss of DICGAN, based on LightCNN.

class mmedit.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 mmedit.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’.

forward(pred: torch.Tensor, gt: torch.Tensor) torch.Tensor[source]

Forward function.

Parameters
  • pred (Tensor) – Predicted tensor.

  • gt (Tensor) – GT tensor.

Returns

Forward results.

Return type

Tensor

Read the Docs v: latest
Versions
master
latest
stable
zyh-re-docs
zyh-doc-notfound-extend
zyh-api-rendering
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.