Exemplo n.º 1
0
 def __init__(self, criterion, geom_weight=1, level_nb=1):
     self.level_nb = level_nb
     self.SP = ScalePyramid()
     if criterion == "l2":
         self.criterion = torch.nn.MSELoss(reduction="none")
     elif criterion == "l1":
         self.criterion = torch.nn.L1Loss(reduction="none")
     elif criterion == "ssim":
         self.criterion = klosses.SSIM(reduction="none")
     else:
         raise ValueError(f"{criterion} not in [l2, l1, ssim]")
     self.geom_weight = geom_weight
Exemplo n.º 2
0
     'piqa.PSNR': piqa.PSNR(),
 }),
 'SSIM': (2, {
     'sk.ssim-np':
     lambda x, y: sk.structural_similarity(
         x,
         y,
         win_size=11,
         multichannel=True,
         gaussian_weights=True,
     ),
     'piq.ssim':
     piq.ssim,
     'kornia.SSIM-halfloss':
     kornia.SSIM(
         window_size=11,
         reduction='mean',
     ),
     'piq.SSIM-loss':
     piq.SSIMLoss(),
     'IQA.SSIM-loss':
     IQA.SSIM(),
     'vainf.SSIM':
     vainf.SSIM(data_range=1.),
     'piqa.SSIM':
     piqa.SSIM(),
 }),
 'MS-SSIM': (2, {
     'piq.ms_ssim': piq.multi_scale_ssim,
     'piq.MS_SSIM-loss': piq.MultiScaleSSIMLoss(),
     'IQA.MS_SSIM-loss': IQA.MS_SSIM(),
     'vainf.MS_SSIM': vainf.MS_SSIM(data_range=1.),
Exemplo n.º 3
0
    def __init__(self):
        super(SSIMLoss, self).__init__()

        self.ssim_loss_5x5 = losses.SSIM(5, reduction='none')
        self.ssim_loss_11x11 = losses.SSIM(11, reduction='none')
Exemplo n.º 4
0
 def __init__(self) -> None:
     super(MSE_SSIMLoss, self).__init__()
     self.ssim = losses.SSIM(window_size=3, reduction='mean')
Exemplo n.º 5
0
 'PSNR': (2, {
     'sk.psnr': sk.peak_signal_noise_ratio,
     'piq.psnr': piq.psnr,
     'kornia.PSNR': kornia.PSNRLoss(max_val=1.),
     'piqa.PSNR': piqa.PSNR(),
 }),
 'SSIM': (2, {
     'sk.ssim': lambda x, y: sk.structural_similarity(
         x, y,
         win_size=11,
         multichannel=True,
         gaussian_weights=True,
     ),
     'piq.ssim': piq.ssim,
     'kornia.SSIM-halfloss': kornia.SSIM(
         window_size=11,
         reduction='mean',
     ),
     'piq.SSIM-loss': piq.SSIMLoss(),
     'IQA.SSIM-loss': IQA.SSIM(),
     'vainf.SSIM': vainf.SSIM(data_range=1.),
     'piqa.SSIM': piqa.SSIM(),
 }),
 'MS-SSIM': (2, {
     'piq.ms_ssim': piq.multi_scale_ssim,
     'piq.MS_SSIM-loss': piq.MultiScaleSSIMLoss(),
     'IQA.MS_SSIM-loss': IQA.MS_SSIM(),
     'vainf.MS_SSIM': vainf.MS_SSIM(data_range=1.),
     'piqa.MS_SSIM': piqa.MS_SSIM(),
 }),
 'LPIPS': (2, {
     'piq.LPIPS': piq.LPIPS(),