jacobgil / keras-grad-cam

An implementation of Grad-CAM with keras
MIT License
658 stars 237 forks source link

Initialize GradCAM mask summation with zeros. #22

Open nalinimsingh opened 6 years ago

nalinimsingh commented 6 years ago

From my read of the GradCAM paper, this matrix should be initialized with zeroes, so that cam contains only the weighted sum of the entries in outputs. Feel free to correct me here if I'm misinterpreting anything!

[This doesn't affect the qualitative trend you see across the image in any of the generated GradCAM masks, since this is a constant shift at each pixel, but it does slightly perturb some of the numeric values.]

potocpav commented 6 years ago

For VGG it doesn't matter, but for my network, this change was necessary to get meaningful results. It is indeed the correct approach.

nalinimsingh commented 6 years ago

@jacobgil Friendly ping -- are you able to review this?

habibrostami commented 5 years ago

I have a model with excellent accuracy an Roc but heat map generated by using grad cam is not reasonable? I used a architecture contains dome conv and batch normalizatio. Thank you