Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Range in MS-SSIM-Loss #39

Closed
tobias-haenel opened this issue Sep 12, 2021 · 4 comments
Closed

Dynamic Range in MS-SSIM-Loss #39

tobias-haenel opened this issue Sep 12, 2021 · 4 comments

Comments

@tobias-haenel
Copy link

Why do you compute the dynamic range in the MS-SSIM VAE from the data range of the reconstructed images. If I understand the original SSIM paper correctly, the dynamic range should be the largest values that the images might assume (e.g. 1.0)?

@AntixK
Copy link
Owner

AntixK commented Sep 13, 2021

DR does not mean the ratio between the maximum and minimum possible values of a given image (in that case, it would be akin to the bit depth). DR is just the ratio between the max and min pixel values. This, in the case of VAEs, depend upon the activation used. If sigmoid is used, the DR is indeed 1.0. However, if activation used is tanh, then DR is 2.0 (1.0 - (-1.0)).

@tobias-haenel
Copy link
Author

tobias-haenel commented Sep 13, 2021

But in the following line (234 of mssim_vae.py)
img_range = img1.max() - img1.min()
You do compute the image pixel value range of the reconstruction batch and not the dynamic range.

@AntixK
Copy link
Owner

AntixK commented Sep 13, 2021

Nice catch. I agree that the img_range can be set to 1 by default or can be given as an additional parameter to the MSSIM class.

@AntixK
Copy link
Owner

AntixK commented Dec 22, 2021

Fixed in #46

@AntixK AntixK closed this as completed Dec 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants