sicara / tf-explain

Interpretability Methods for tf.keras models with Tensorflow 2.x
https://tf-explain.readthedocs.io
MIT License
1.02k stars 111 forks source link

Opacity in heatmap_display causing improper display of gradCAM for small images(Ex:- CIFAR10) #103

Closed ksasi closed 4 years ago

ksasi commented 4 years ago

Hi,

It appears the opacity parameter settings in heatmap_display are causing gradCAM to not properly superimpose on original images. This is specifically being seen when using CIFAR10 and small size data sets.

I think the following line needs a review in display.py file for heatmap_display function.

output = cv2.addWeighted(cv2.cvtColor(image, cv2.COLOR_RGB2BGR), 0.7, heatmap, 1, 0)

Thanks and Regards, Sasikanth

RaphaelMeudec commented 4 years ago

Okay, will look into it and probably make it tuneable. Thanks for raising this!

RaphaelMeudec commented 4 years ago

The argument image_weight has been added to GradCAM so users can set their own superposition value.