Search code examples
pythontensorflowartificial-intelligencetensorflow2.0

Generating a heatmap from a image


So I've have trained a simple image classifier in TensorFlow 2.0, I based it on this, it uses the second method from the website because the first one, where it doesn't use Dropout or Data augmentation overfits a bit.

So now I need to generate a heatmap for where it thinks the class is (I don't need it for flowers like the TensorFlow tutorial).

I watched a Computerphile video which suggests that I should use a CNN for this problem.

So if I do train a network like this would it need photos with the class's positions or just images?

Please answer.


Solution

  • You need something like Grad-CAM "..a technique for making Convolutional Neural Network (CNN)-based models more transparent by visualizing the regions of input that are "important" for predictions from these models - or visual explanations."

    Here is some links that covers it from the start.

    https://www.pyimagesearch.com/2020/03/09/grad-cam-visualize-class-activation-maps-with-keras-tensorflow-and-deep-learning/

    https://medium.com/@mohamedchetoui/grad-cam-gradient-weighted-class-activation-mapping-ffd72742243a

    And the following is the original paper:

    http://gradcam.cloudcv.org/