Skip to content

SSIM index maps #53115

Closed
Closed

Description

@MaggieLieu

System information

  • TensorFlow version (you are using): 2.7
  • Are you willing to contribute it (Yes/No): No

Describe the feature and the current behavior/state.
Currently tf.image.ssim() returns a global ssim value but it would be useful to have it return a non globally averaged value as per
e.g. https://uk.mathworks.com/help/images/ref/ssim.html that would allow the making of ssim index maps

Will this change the current api? How?

Who will benefit with this feature?
anyone doing computer vision

Any Other info.

Activity

  1. added
    TF 2.7
    comp:ops
    on Nov 19, 2021
  2. mohantym commented on Nov 19, 2021

    @mohantym
    Contributor

    Hi @sanatmpa1! Could you look into this feature request?

  3. sachinprasadhs commented on Nov 24, 2021

    @sachinprasadhs
    Contributor

    Could you please elaborate your feature request and provide some code to show what is implemented and what changes in result you are expecting. Thanks!

  4. added
    stat:awaiting response
    on Nov 24, 2021
  5. MaggieLieu commented on Nov 30, 2021

    @MaggieLieu
    Author

    Hi,

    Yes so the results I am expecting are like that shown here: https://uk.mathworks.com/help/images/ref/ssim.html for the local ssim map. So it's a SSIM value for each pixel rather than the mean.

    I believe that it comes in the function _ssim_per_channel() where the SSIM values are computed but then it returns the global mean rather than the pixel values.

    ssim_val = math_ops.reduce_mean(luminance * cs, axes)
    cs = math_ops.reduce_mean(cs, axes)
    return ssim_val, cs

    And the ssim() function

    ssim_per_channel, _ = _ssim_per_channel(img1, img2, max_val, filter_size,
    filter_sigma, k1, k2)
    return math_ops.reduce_mean(ssim_per_channel, [-1])

  6. removed
    stat:awaiting response
    on Dec 2, 2021
  7. added
    stat:awaiting tensorflower
    on Dec 2, 2021
  8. added
    stat:contribution welcome
    on Dec 9, 2021
  9. rainwoodman commented on Dec 9, 2021

    @rainwoodman
    Member

    Thanks MaggieLieu for tracking this down!

    We can add a 'return_index_map=False/True' argument to ssim to maintain backward compatibility: when return_index_map is True, returns the index map; when return_idnex_map is False, return the reduced global value.

    Since you have already identified where to change, would you mind contributing a PR?

    PS: Here is a reference where it is explicitly described that the global ssim value is the mean of the local ssim value: https://medium.com/srm-mic/all-about-structural-similarity-index-ssim-theory-code-in-pytorch-6551b455541e .

  10. CohenAriel commented on Jul 13, 2022

    @CohenAriel
    Contributor

    Hey @rainwoodman, can I create a PR for this?

  11. rainwoodman commented on Jul 13, 2022

    @rainwoodman
    Member

    That would be nice. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

TF 2.7comp:opsstat:awaiting tensorflowerstat:contribution welcometype:feature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions