Comments (8)
Currently only the tensorflow backend is supported, so the immediate thing would be to switch the keras backend to tensorflow.
I'll take a look later to try get it working with theano too.
from keras-grad-cam.
D'oh ... obviously! My bad: I switched to TensorFlow backend and now get the following error message:
File "grad-cam.py", line 72, in <module>
cam = grad_cam(model, preprocessed_input, predicted_class, "block5_pool")
File "grad-cam.py", line 41, in grad_cam
grads = normalize(K.gradients(loss, conv_output)[0])
TypeError: Expected binary or unicode string, got <keras.layers.pooling.MaxPooling2D object at 0x119beaf10>
from keras-grad-cam.
Can you please check your tensorflow and keras versions?
That can be done by:
import tensorflow as tf
print tf.__version__
import keras
print keras.__version__
Perhaps tensorflow should be upgraded.
Also please make sure the code in grad-cam.py was not modified.
from keras-grad-cam.
Sure: tensorflow is at 0.11.0 and Keras at 1.1.1.
Haven't dabbled with the code either!
from keras-grad-cam.
@thiippal I think you can use the debug mode to check the code line by line, and then tell him the code in which line is not correct. I use theano instead of tensorflow, but I carefully read the code and it seems that there are no errors.
from keras-grad-cam.
I wasn't able to reproduce the error with these tensorflow and keras versions.
Are you sure that both the dimension ordering and backend are tensorflow, like this:
{
"image_dim_ordering": "tf",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "tensorflow"
}
?
from keras-grad-cam.
I checked my Keras configuration file: the backend and image dimensions are both set for tensorflow.
Anyhow, I created a fresh virtual environment with Keras and TensorFlow and cloned the repository again, and now it works. I don't recall making any changes to the code, but it is likely that I might have tinkered with it.
My apologies for the unnecessary work on your behalf; I really appreciate your Keras implementations of all these new techniques.
from keras-grad-cam.
Thank you.
If you have thoughts on how to improve this or experimentations worth doing please suggest!
from keras-grad-cam.
Related Issues (20)
- Regarding the gradient
- ValueError: Tried to convert 'x' to a tensor and failed. Error: None values not supported. HOT 9
- 'Node' object has no attribute 'output_masks' HOT 2
- saliency is NaN for VGG16 like model with BatchNorm HOT 1
- It does not match exactly. Why?
- AttributeError: Layer vgg16 has multiple inbound nodes, hence the notion of "layer input" is ill-defined. Use `get_input_at(node_index)` instead. HOT 7
- Grad-Cam for custom defined architecture HOT 3
- 3D images HOT 2
- zero mean intensity of gradient for some cases HOT 9
- high accuracy model with weak heatmap
- I feel using the gradient of last conv layer rule is more reasonable
- How can i use it with fully convolutional network??
- Running with cifar10 datset
- You must feed a value for placeholder tensor 'input_1_1' with dtype float and shape [?,299,299,3] HOT 1
- Apply GradCam to Cnn+LSTM HOT 2
- GradCam calculation
- 环境配置
- question: why replace keras.activations.relu to tf.nn.relu
- Requesting help with GradCam on Segmentation
- Grad-CAM for timeseries custom architecture
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keras-grad-cam.