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

Doubt about Grad-CAM++ weights computation #2

Open
lucasdavid opened this issue Feb 13, 2021 · 0 comments
Open

Doubt about Grad-CAM++ weights computation #2

lucasdavid opened this issue Feb 13, 2021 · 0 comments

Comments

@lucasdavid
Copy link

Hello!
Thanks for the repository. Very pretty code and I'm learning a lot from it :-)

I have a question about the way you implemented Grad-CAM++.
More specifically, in the denominator computation at cam.py#L220:

ag = activations * gradients.pow(3)
denominator += ag.view(n, c, -1).sum(-1, keepdim=True).view(n, c, 1, 1)

So, if I understood correctly, you are:

  1. weighting each element of the gradient matrix gradients.pow(3) by the pixel activation activations
  2. sum over each pixel, for each channel

However, in the article, the authors state that the sum indices are not the same as the indices in the partial derivative (attached image). I assumed that meant we should first sum all activations and then multiply by the grads^3.

Am I missing something here?
Thank you very much!

image

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

No branches or pull requests

1 participant