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

[Feature Request] MaskedSSIM to calculate SSIM on images with valid pixel mask #50

Open
blutjens opened this issue Jan 26, 2024 · 0 comments · May be fixed by #53
Open

[Feature Request] MaskedSSIM to calculate SSIM on images with valid pixel mask #50

blutjens opened this issue Jan 26, 2024 · 0 comments · May be fixed by #53

Comments

@blutjens
Copy link

Great repository! I am working on a deep learning application where about 70% of the pixels in my ground truth target images are masked, because they contain invalid pixels. Is there a way to extend this repository to calculate the SSIM only over valid pixels?

As a first step, it would be really helpful to add the torch argument: reduction = 'none' and have _ssim() return the ssim_map instead of the average across all pixels in the image. It's not perfect, but from there one could calculate an approximate MaskedSSIM by averaging SSIM only over valid pixels.

torch reduction argument for reference:
reduction (str, optional) – Specifies the reduction to apply to the output: 'none' | 'mean' | 'sum'. 'none': no reduction will be applied, 'mean': the sum of the output will be divided by the number of elements in the output, 'sum': the output will be summed. Note: size_average and reduce are in the process of being deprecated, and in the meantime, specifying either of those two args will override reduction. Default: 'mean'

@jinhwanlazy jinhwanlazy linked a pull request Mar 12, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant