pyiqa.losses.iqa_losses

Module Contents

pyiqa.losses.iqa_losses.emd_loss(pred, target, r=2)[source]
Parameters:
  • pred (Tensor) – of shape (N, C). Predicted tensor.

  • target (Tensor) – of shape (N, C). Ground truth tensor.

  • r (float) – norm level, default l2 norm.

class pyiqa.losses.iqa_losses.EMDLoss(loss_weight=1.0, r=2, reduction='mean')[source]

Bases: torch.nn.Module

EMD (earth mover distance) loss.

forward(pred, target, weight=None, **kwargs)[source]
pyiqa.losses.iqa_losses.plcc_loss(pred, target)[source]
Parameters:
  • pred (Tensor) – of shape (N, 1). Predicted tensor.

  • target (Tensor) – of shape (N, 1). Ground truth tensor.

class pyiqa.losses.iqa_losses.PLCCLoss(loss_weight=1.0)[source]

Bases: torch.nn.Module

PLCC loss, induced from Pearson’s Linear Correlation Coefficient.

forward(pred, target)[source]
class pyiqa.losses.iqa_losses.RankLoss(detach=False, loss_weight=1.0)[source]

Bases: torch.nn.Module

Monotonicity regularization loss, will be zero when rankings of pred and target are the same.

Reference:
forward(pred, target)[source]
pyiqa.losses.iqa_losses.norm_loss_with_normalization(pred, target, p, q)[source]
Parameters:
  • pred (Tensor) – of shape (N, 1). Predicted tensor.

  • target (Tensor) – of shape (N, 1). Ground truth tensor.

class pyiqa.losses.iqa_losses.NiNLoss(loss_weight=1.0, p=1, q=2)[source]

Bases: torch.nn.Module

NiN (Norm in Norm) loss

Reference:

This loss can be simply described as: l1_norm(normalize(pred - pred_mean), normalize(target - target_mean))

forward(pred, target)[source]