elazarcoh / simply-view-image-for-python-debugging

visual studio code extension simply view the image of the image variables when debugging python
https://marketplace.visualstudio.com/items?itemName=elazarcoh.simply-view-image-for-python-debugging
MIT License
57 stars 6 forks source link

Feature request: toggle image normalization #52

Closed YoniChechik closed 8 months ago

YoniChechik commented 1 year ago

First let me say that this is an amazing extansion! I'm using it almost daily since installed, and brought more people on board :)

As a Computer Vision engineer I often want to view uint8 (0-255)/ float (0-1) images without normalization, so here I've changed the extension default- this is importent for me to view changes in image brightness and much more. But sometimes I view some irregular images (e.g. uint8 masks with indices of 0-9), and then I do want the normalization.

I suggest that there would to button to view images, one with normalization and one without. Another suggestion can be to have the same arrangment, but add another option via right click, so the option to alternate between states will be easier.

elazarcoh commented 1 year ago

Sounds reasonable enough. For your use case, does it need to be normalized/raw on a variable basis (as opposed to a global setting affecting all variables)? For a variable basis, I'm more inclined towards one of the following solutions:

  1. add a right click to the variable entry in the tree
  2. add a way to change it on the subtree of a variable
  3. orthogonally to the above, I can add a heuristic way of deciding whether normalizing is better or worse for a given image (e.g. decide based dtype and min/max values).

I don't want to add a separate inline button, as it's already kinda clattered as is (for my taste, at least).

Would love to hear your thoughts, and any other suggestions.

YoniChechik commented 1 year ago

I can describe a common use-case: we have some semantic segmentation task with 10 classes (e.g. for medical: red blood cell, white blood cell, etc...), for the actual images we want to view them without any normalization (from PIL/opencv they would normally be uint8 0-255, as tensors they can be floats 0-1). But when we check the masks we do like to normalize them (the mask will be uint8 from 0-9).

I guess that the default button can be according to the normalization settings, and when you right click you can choose to view it normalized or raw. I wouldn't do solution 3 because for different tasks different paradigms will be used and I guess it would be hard to do a good generalized heuristic.

elazarcoh commented 10 months ago

This is on pre-release! please check it out.

YoniChechik commented 8 months ago

I've used the pre-release for the last week because of the debugpy bug and I must say that it's AMAZING!!! Thank you so much for the hard work!

Hope it will be released soon as a regular release