raghakot / keras-vis

Neural network visualization toolkit for keras
https://raghakot.github.io/keras-vis
MIT License
2.97k stars 664 forks source link

Visualize_saliency breaks for 1D Inputs #103

Closed karthikbmk closed 5 years ago

karthikbmk commented 6 years ago

Bug : Currently, visualize_saliency returns 3D gradients for 1D Inputs.

Possible Fix : In visualize_saliency_with_losses function, replace *return np.uint8(cm.jet(grads)[..., :3] 255)[0] with return grads[0]**

ghost commented 6 years ago

This seems to have been fixed in #67. I installed through pip and I see the older version (return np.uint8(cm.jet(grads)[..., :3] * 255)[0]) in my copy. I've cleaned my previous installation and installed from source using setup.py. This works for me now. I ran attention.ipynb in the examples/mnist folder and I get grads as an array of size (28, 28) now. I do not know why pip install wasn't picking up the latest version though.

ghost commented 6 years ago

I'm curious, is there a way to recover grads[0] from *np.uint8(cm.jet(grads)[...,:3]255)[0]**?