pyiqa.losses.iqa_losses ======================= .. py:module:: pyiqa.losses.iqa_losses Module Contents --------------- .. py:function:: emd_loss(pred, target, r=2) :param pred: of shape (N, C). Predicted tensor. :type pred: Tensor :param target: of shape (N, C). Ground truth tensor. :type target: Tensor :param r: norm level, default l2 norm. :type r: float .. py:class:: EMDLoss(loss_weight=1.0, r=2, reduction='mean') Bases: :py:obj:`torch.nn.Module` EMD (earth mover distance) loss. .. py:method:: forward(pred, target, weight=None, **kwargs) .. py:function:: plcc_loss(pred, target) :param pred: of shape (N, 1). Predicted tensor. :type pred: Tensor :param target: of shape (N, 1). Ground truth tensor. :type target: Tensor .. py:class:: PLCCLoss(loss_weight=1.0) Bases: :py:obj:`torch.nn.Module` PLCC loss, induced from Pearson’s Linear Correlation Coefficient. .. py:method:: forward(pred, target) .. py:class:: RankLoss(detach=False, loss_weight=1.0) Bases: :py:obj:`torch.nn.Module` Monotonicity regularization loss, will be zero when rankings of pred and target are the same. Reference: - https://github.com/lidq92/LinearityIQA/blob/master/IQAloss.py .. py:method:: forward(pred, target) .. py:function:: norm_loss_with_normalization(pred, target, p, q) :param pred: of shape (N, 1). Predicted tensor. :type pred: Tensor :param target: of shape (N, 1). Ground truth tensor. :type target: Tensor .. py:class:: NiNLoss(loss_weight=1.0, p=1, q=2) Bases: :py:obj:`torch.nn.Module` NiN (Norm in Norm) loss Reference: - Dingquan Li, Tingting Jiang, and Ming Jiang. Norm-in-Norm Loss with Faster Convergence and Better Performance for Image Quality Assessment. ACMM2020. - https://arxiv.org/abs/2008.03889 - https://github.com/lidq92/LinearityIQA This loss can be simply described as: l1_norm(normalize(pred - pred_mean), normalize(target - target_mean)) .. py:method:: forward(pred, target)