kaira.losses.image.PSNRLoss

Inheritance diagram of PSNRLoss

Inheritance diagram for PSNRLoss

class kaira.losses.image.PSNRLoss(max_val=1.0)[source]

Bases: BaseLoss

Peak Signal-to-Noise Ratio (PSNR) Loss Module.

This module calculates the negative PSNR (to be minimized) between the input and target. PSNR is a standard metric for image quality assessment [Hore and Ziou, 2010], though it doesn’t always correlate well with human perception [Huynh-Thu and Ghanbari, 2008].

Methods

__init__

Initialize the PSNRLoss module.

forward

Forward pass through the PSNRLoss module.

__init__(max_val=1.0)[source]

Initialize the PSNRLoss module.

Parameters:

max_val (float) – Maximum value of the input tensor. Default is 1.0.

forward(x: Tensor, target: Tensor) Tensor[source]

Forward pass through the PSNRLoss module.

Parameters:
Returns:

The negative PSNR loss between the input and the target.

Return type:

torch.Tensor