SSIMLoss#

Using any mix value less than 1 applies corrected L1 loss in addition to SSIM loss, as derived from Zhao et al., 2018.

from pssr.util import SSIMLoss
pssr.util.SSIMLoss.__init__(self, channels: int = 1, mix: float = 0.8, win_size: int = 11, win_sigma: float = 1.5, ms: bool = True, kwargs=None)#

SSIM and MS-SSIM loss with Mix as detailed in Zhao et al., 2018.

Parameters:
  • channels (int) – Number of channels in image. Default is 1.

  • mix (float) – Mix of SSIM loss in loss calculation. 1 is entirely SSIM, 0 is entirely L1 with Gaussian correction. Default is 0.8.

  • win_size (int) – Size of Gaussian window. Must be odd. Default is 11.

  • win_sigma (float) – Sigma for distribution of Gaussian window. Default is 1.5.

  • ms (bool) – Whether to use MS-SSIM over basic SSIM. Default is True.

  • kwargs (dict[str, Any]) – Keyword arguments for pytorch_msssim.