GithubHelp home page GithubHelp logo

Comments (3)

raghakot avatar raghakot commented on August 30, 2024 1

Closing this per offline discussion on slack

from keras-vis.

raghakot avatar raghakot commented on August 30, 2024

There are a couple of things going on there.

  1. The reason visualize_cam output is bad because the penultimate conv layer have an output shape of (1, 1, 128). So we are essentially only getting (1, 1) output for weights. Try using the conv layer before that which has (5, 5) image resolution. You can do so by setting penultimate_layer_idx=3 or 2. By default, it picks the lowest conv layer which has too small of an output resolution.

  2. Even after I set a higher penultimate layer, the output was a constant heatmap, but that was because of a numerical issue. Essentially with small grad values, the computation is overflowing float32 precision and turning into zeros, effectively wiping out the heatmap information. since heatmap is initialized with all 1's you are seeing that red output everywhere. I just pushed a commit to fix that.

  3. K.set_learning_phase(0) on the top, is a keras weirdness. Keras maintains an internal dictionary of various learning phases in a model graph (for example dropout) during construction time. By setting it ahead of model construction, you are also messing up your own model. to see what i mean, set a beakpoint of k.learning_phase() within keras code to see how it gets triggered with and without that top line. I noticed that it doesnt register learning phase for second dropout which is odd. I will investigate further but it might be a keras bug. In either case, this is more of a keras issue and i am out of options on what i can do here. There might be some hacky workarounds but i wouldn't want to include it in the lib.

from keras-vis.

metecanakar avatar metecanakar commented on August 30, 2024

I am also having this problem. When training the keras pre-trained model, I first set keras to inference mode by K.set_learning_phase(0) to load the pre-trained model and then set keras to training mode by K.set_learning_phase(1). Unfortunately, this weird implementation is recommended by keras.

When I want to visualize learnt features of the neural network I get the same error (Cannot interpret feed_dict key as Tensor: Can not convert a int into a Tensor.)

Are there any news about this problem? @raghakot

from keras-vis.

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.