Git Product home page Git Product logo

Comments (8)

jacobgil avatar jacobgil commented on June 14, 2024 2

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.

thiippal avatar thiippal commented on June 14, 2024

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.

jacobgil avatar jacobgil commented on June 14, 2024

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.

thiippal avatar thiippal commented on June 14, 2024

Sure: tensorflow is at 0.11.0 and Keras at 1.1.1.

Haven't dabbled with the code either!

from keras-grad-cam.

jf003320018 avatar jf003320018 commented on June 14, 2024

@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.

jacobgil avatar jacobgil commented on June 14, 2024

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.

thiippal avatar thiippal commented on June 14, 2024

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.

jacobgil avatar jacobgil commented on June 14, 2024

Thank you.
If you have thoughts on how to improve this or experimentations worth doing please suggest!

from keras-grad-cam.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.