raghakot / keras-vis

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

transpose error when running example of saliency #10

Closed Lopezurrutia closed 7 years ago

Lopezurrutia commented 7 years ago

I am running keras with theano backend, versions:

pip show keras Name: Keras Version: 1.2.0 Summary: Deep Learning for Python Home-page: https://github.com/fchollet/keras Author: Francois Chollet Author-email: francois.chollet@gmail.com License: MIT Location: /mnt/gelu/anaconda2/envs/theano/lib/python2.7/site-packages Requires: theano, pyyaml, six

Name: Theano Version: 0.8.2 Summary: Optimizing compiler for evaluating mathematical expressions on CPUs and GPUs. Home-page: http://deeplearning.net/software/theano/ Author: LISA laboratory, University of Montreal Author-email: theano-dev@googlegroups.com License: BSD Location: /mnt/gelu/anaconda2/envs/theano/lib/python2.7/site-packages Requires: six, numpy, scipy

When trying to reproduce the code in https://raghakot.github.io/keras-vis/visualizations/attention/ I get the following error: Working on filters: [292] Traceback (most recent call last): File "", line 1, in File "/mnt/gelu/fastai/fish/kerasvis.py", line 7, in from vis.visualization import visualize_saliency File "/mnt/gelu/anaconda2/envs/theano/lib/python2.7/site-packages/vis/visualization.py", line 156, in visualize_saliency grads = utils.deprocess_image(grads[0]) File "/mnt/gelu/anaconda2/envs/theano/lib/python2.7/site-packages/vis/utils/utils.py", line 66, in deprocess_image img = img.transpose((1, 2, 0)) ValueError: axes don't match array

delahe commented 7 years ago

I have the same issue, did you find any solution for that ?

raghakot commented 7 years ago

I really need to add tests. All the rapid refactoring is messing stuff up.

raghakot commented 7 years ago

Fixed in latest commit. I also added tests to make sure i dont break stuff again.