Closed Jonas1312 closed 5 years ago
@Abhijit-2592 and @sakares Can you take a look at my code please? Thanks
@Jonas1312. Mmm.. Check whether class: "0" belongs to cat, and class: "1" belongs to dog (or can be vice versa, it is important to know which number is what class), And more over in this line, you have mentioned 0 for both the cases (filter_indices takes in the index of the class you are trying to visualise). If it still fails first verify whether your network has learned something.
I would recommend you first try it with imagenet classes so that you can understand how to visualize grad-cam using keras-vis. Then using it on your custom project becomes easier
@Abhijit-2592 Thanks for your quick answer
Actually my code is really similar to the InceptionV3 model, I just replaced the 1000 classes by 2 classes (cats and dogs). I retrained the network by freezing the InceptionV3 base_model layers and I reached 99% accuracy in less than 3 epochs.
I tried both filter_indices=0 and filter_indices=1 with cats and dogs images but the result is still the same...
Images with filter_indices=1:
And yes "0" belongs to cat, and class: "1" belongs to dog, I double-checked it.
Training or validation or testing accuracy of 99? Try running a quick model.predict() on a set of test images to check if the network has learnt. set by_name = False while loading the weights. I suspect the weight loading being a prob
Hi, I'm currently trying to generate heatmap using grad-cam from my InceptionV3 model but I'm getting weird results:![capture](https://user-images.githubusercontent.com/15847892/37389169-9189dc3c-27a6-11e8-9121-93f14e45fc3c.PNG)
Here is my code: https://gist.github.com/Jonas1312/e74cb8b0b39ddebb5c5666a3fa59299f
And the end of the network summary:![capture](https://user-images.githubusercontent.com/15847892/37390015-c87f4346-27a9-11e8-9f84-490d5ac689c6.PNG)
[x] Check that you are up-to-date with the master branch of keras-vis. You can update with: pip install git+git://github.com/raghakot/keras-vis.git --upgrade --no-deps
[x] If running on TensorFlow, check that you are up-to-date with the latest version. The installation instructions can be found here.
[x] If running on Theano, check that you are up-to-date with the master branch of Theano. You can update with: pip install git+git://github.com/Theano/Theano.git --upgrade --no-deps
[x] Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short).