kaira.losses.image.MSSSIMLoss

Inheritance diagram of MSSSIMLoss

Inheritance diagram for MSSSIMLoss

class kaira.losses.image.MSSSIMLoss(kernel_size: int = 11, data_range: float = 1.0)[source]

Bases: BaseLoss

Multi-Scale Structural Similarity Index Measure (MS-SSIM) Loss Module.

This module calculates the MS-SSIM loss between the input and the target. MS-SSIM extends SSIM by evaluating similarity at multiple scales, making it more robust to viewing distance variations [Wang et al., 2003].

Methods

__init__

Initialize the MSSSIMLoss module.

forward

Forward pass through the MSSSIMLoss module.

__init__(kernel_size: int = 11, data_range: float = 1.0)[source]

Initialize the MSSSIMLoss module.

Parameters:
  • kernel_size (int) – Size of the Gaussian kernel used in SSIM calculation.

  • data_range (float) – Range of the input data (typically 1.0 or 255).

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

Forward pass through the MSSSIMLoss module.

Parameters:
Returns:

The MS-SSIM loss between the input and the target.

Return type:

torch.Tensor