keras-vis
keras-vis copied to clipboard
Possible miscalculation within grad-cam
I feel like this makes more sense as np.minimum?
Based on the comment above and the results it produces.
An example can be seen below. Negative gradients are removed with np.minimum()
>> a = np.array([1.0, -1.0])
>> np.maximum(a, 0)
[0, -1.0]
>> np.minimum(a, 0)
[1.0, -1.0]
I've run your code. But I could not reproduce the same result.
In [1]: import numpy as np
In [2]: a = np.array([1.0, -1.0])
In [3]: np.maximum(a, 0)
Out[3]: array([1., 0.])
In [4]: np.minimum(a, 0)
Out[4]: array([ 0., -1.])