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:
- weighting each element of the gradient matrix
gradients.pow(3) by the pixel activation activations
- 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!

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:
So, if I understood correctly, you are:
gradients.pow(3)by the pixel activationactivationsHowever, 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!