Skip to content

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

Open
@blutjens

Description

@blutjens

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions