Closed subhashis closed 5 years ago
Currently, keras-vis in PyPI is quite old. The cause of your problem is the bug of keras-vis in old version.
Please re-install keras-vis of currently master branch, as follows:
$ pip install git+https://github.com/raghakot/keras-vis.git -U
or
$ git clone https://github.com/raghakot/keras-vis.git
$ cd keras-vis
$ python setup.py install
I updated my keras-vis version to the latest version. The output of the visualize_saliency( ) is now just a single scalar value instead of the vector of size 35 (which is the size of my input vector). @keisen is this the expected outcome for the api call I made (above)
@subhashis , it's good. Do you have any problem yet? If there is no problem, please close this issue.
@keisen I don't think the problem has been solved yet.
With an input vector of size 35 the expected dimension of the saliency map is 35 as well. But currently, it is returning just a single scalar value.
On inspecting the visualize_saliency_with_losses( ) function I saw that the last two lines are
grads = np.max(grads, axis=channel_idx)
return utils.normalize(grads)[0]
before updating grads, its dimension was (1,35), which actually matches with my input vector dimension.
@subhashis , Thanks!
I created the PR #137 to fix this issue. So please make sure of what there is no your problem in this PR.
issues/#135
Sorry, I forgot to mention one thing.
visualize_saliency_with_losses(input_tensor, losses, seed_input, keepdims=True)
I have a fully connected network with 1d input of size 35 and generates 1d output of size 50. I wanted to compute the saliency map for given inputs for this network. However, the output of the visualize_saliency(... ) function is just returning me an array of size 3 (instead for size 35 i.e. my input size).
my model structure
M1.summary()
Not sure where is the problem. Any help would be really appreciated. Thanks!