Skip to content

SSIM as a loss function and LPIPS input range #9

Discussion options

You must be logged in to vote

Hello Niels 👋

Thanks for your interest!

The minus is needed because you don’t have a different score defined with SSIM but a similarity score [...]

By definition, SSIM is a similarity score, meaning that it is higher when the inputs are closer. I cannot define it otherwise. When a loss function is needed, we usually define a metric SSIMLoss(x, y) that computes 1 - SSIM(x, y) which is a measure of dissimilarity. An easy way to do that with PIQA is

class SSIMLoss(SSIM):
    def forward(*args, **kwargs):
        return 1. - super().forward(*args, **kwargs)

Moreover, why do you define SSIM as just the mean part of the SSIM score? So why you ignore the Contrast Sensitivity part of the SSIM …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@niels-leif-bracher
Comment options

@francois-rozet
Comment options

Answer selected by niels-leif-bracher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants