SSIM as a loss function and LPIPS input range #9
-
Hi Francois Rozet, First, I think the correct definition of the SSIM as criterion should be: criterion = SSIM()
l = -criterion(x, y) The minus is needed because you don’t have a different score defined with SSIM but a similarity score which is best when it returns 1 right? So with the minus, the returned range of values is 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 when you define l in SSIM to be Secondly, for the LPIPS package I found in other packages that the input should be in range Kind regards Niels Bracher |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hello Niels 👋 Thanks for your interest!
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 class SSIMLoss(SSIM):
def forward(*args, **kwargs):
return 1. - super().forward(*args, **kwargs)
The Contrast Sensitivity (CS) is not ignored, it is already in SSIM. This is described in the documentation and the product by Line 111 in a3ca951 FYI, the implementations of
The short answer is In the original implementation the inputs were indeed scaled to If you have any more questions, feel free to ask 😉 |
Beta Was this translation helpful? Give feedback.
Hello Niels 👋
Thanks for your interest!
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 computes1 - SSIM(x, y)
which is a measure of dissimilarity. An easy way to do that withPIQA
is