pyiqa.losses ============ .. py:module:: pyiqa.losses Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/pyiqa/losses/iqa_losses/index /autoapi/pyiqa/losses/loss_util/index /autoapi/pyiqa/losses/losses/index Package Contents ---------------- .. py:class:: CharbonnierLoss(loss_weight=1.0, reduction='mean', eps=1e-12) Bases: :py:obj:`torch.nn.Module` Charbonnier loss (one variant of Robust L1Loss, a differentiable variant of L1Loss). Described in "Deep Laplacian Pyramid Networks for Fast and Accurate Super-Resolution". :param loss_weight: Loss weight for L1 loss. Default: 1.0. :type loss_weight: float :param reduction: Specifies the reduction to apply to the output. Supported choices are 'none' | 'mean' | 'sum'. Default: 'mean'. :type reduction: str :param eps: A value used to control the curvature near zero. Default: 1e-12. :type eps: float .. py:method:: forward(pred, target, weight=None, **kwargs) :param pred: of shape (N, C, H, W). Predicted tensor. :type pred: Tensor :param target: of shape (N, C, H, W). Ground truth tensor. :type target: Tensor :param weight: of shape (N, C, H, W). Element-wise weights. Default: None. :type weight: Tensor, optional .. py:class:: L1Loss(loss_weight=1.0, reduction='mean') Bases: :py:obj:`torch.nn.Module` L1 (mean absolute error, MAE) loss. :param loss_weight: Loss weight for L1 loss. Default: 1.0. :type loss_weight: float :param reduction: Specifies the reduction to apply to the output. Supported choices are 'none' | 'mean' | 'sum'. Default: 'mean'. :type reduction: str .. py:method:: forward(pred, target, weight=None, **kwargs) :param pred: of shape (N, C, H, W). Predicted tensor. :type pred: Tensor :param target: of shape (N, C, H, W). Ground truth tensor. :type target: Tensor :param weight: of shape (N, C, H, W). Element-wise weights. Default: None. :type weight: Tensor, optional .. py:class:: MSELoss(loss_weight=1.0, reduction='mean') Bases: :py:obj:`torch.nn.Module` MSE (L2) loss. :param loss_weight: Loss weight for MSE loss. Default: 1.0. :type loss_weight: float :param reduction: Specifies the reduction to apply to the output. Supported choices are 'none' | 'mean' | 'sum'. Default: 'mean'. :type reduction: str .. py:method:: forward(pred, target, weight=None, **kwargs) :param pred: of shape (N, C, H, W). Predicted tensor. :type pred: Tensor :param target: of shape (N, C, H, W). Ground truth tensor. :type target: Tensor :param weight: of shape (N, C, H, W). Element-wise weights. Default: None. :type weight: Tensor, optional .. py:class:: WeightedTVLoss(loss_weight=1.0, reduction='mean') Bases: :py:obj:`L1Loss` Weighted TV loss. :param loss_weight: Loss weight. Default: 1.0. :type loss_weight: float .. py:method:: forward(pred, weight=None) :param pred: of shape (N, C, H, W). Predicted tensor. :type pred: Tensor :param target: of shape (N, C, H, W). Ground truth tensor. :type target: Tensor :param weight: of shape (N, C, H, W). Element-wise weights. Default: None. :type weight: Tensor, optional .. 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: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:: 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)