pytorch-msssim
pytorch-msssim copied to clipboard
Conversion of Image's Colorspace?
Hi, I came across this while looking for a PyTorch implementation of SSIM. On the Tensorflow page for SSIM it's mentioned that "Note: The true SSIM is only defined on grayscale. This function does not perform any colorspace transform. (If the input is already YUV, then it will compute YUV SSIM average.)"
I was wondering if there are any conversions (either to YUV or to grayscale) that I would have to do to use this. My images are all RGB images.
Hi @akashsara , the repo is consistent with tensorflow's ssim. So, it does not requires any conversions if RGB ssim is what you want.
BTW, the benckmark in readme was based on RGB ssim/ms-ssim.
Hi @VainF, thank you for the response! Please correct me if I'm mistaken but my understanding of SSIM is that we should calculate it based on luminance. In the case of a YUV image we consider only the Y (luminance) channel and in the case of a grayscale image, we only have luminance to work with. If you are calculating SSIM separately for each channel and then taking the mean, then I think the results are slightly off since converting RGB to luminance follows a different formula (Ref: https://en.wikipedia.org/wiki/Relative_luminance)