How to clip the positive gradients when using visualization_cam for keras-vis?

Hello,

I am using the function visualization_cam (Grad-CAM) from keras-vis to get a heatmap of a predicted class of an image. With this function, it is possible to clip the negative gradients when the parameter “grad_modifier” is set to “relu”.

However, I would like to get only the negative gradients. Is there a way when using this function to clip the positive gradients ?

“Grad_modifier” can be set to “negate” but the positive gradients are unfortunately not clipped.

Thank you.

© Copyright 2013-2019 Analytics Vidhya