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

Grad-Cam mask tutorial #320

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

CristianCosci
Copy link

Hi!
I made this notebook tutorial to learn how to get and reuse a mask returned from grad-cam information.
The notebook is currently a draft, I created the pull request to get feedback, in order to know if this work could be considered useful or not.
In the event of a positive response, I can make any corrections deemed necessary and improve the text and layout of the notebook 😄.

@jacobgil
Copy link
Owner

jacobgil commented Aug 27, 2022

Hi Cristian, thanks a lot for the PR.

I think a notebook on using the CAM results for different masks is great,
but I think it needs some additions for the most common use cases:

  1. Generate a threshold based on the Q'th percetntile, for example keep only the 20% of the pixels with the highest values,
    and then generate a binary mask with this threshold.

  2. Use an adaptive thresholding like otsu's method that's implemented in opencv, to binarize the CAM.

  3. Alternatively, just multiply the CAM (not the binary mask) by the RGB image itself !

And as a bonus:
Use the CAM to extract bounding boxes.

@CristianCosci
Copy link
Author

Hi! 😄
I am very happy that such a notebook can be found useful.
I am aware that the notebook I currently loaded is very poor, but I created it because I wanted to give an idea of what I was going to do.
Now I make a commitment and make all the necessary adjustments and changes that you suggested (I think it will take me some time because these days I am full of work, but I promise to finish as soon as possible 💪).
Thank you very much! 💯

@TRex22
Copy link

TRex22 commented Nov 5, 2022

I just want to pipe in and say Ive need to do some of this as part of my work.
I havent yet looked at bounding boxes fully but also something I need to do.

For me its more on the input side rather than output side but once I get to this part of my work Im happy to check out this notebook and possibly add stuff.

Just saying this would be a much appreciated addition

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 this pull request may close these issues.

3 participants