Comments (3)
Closing this per offline discussion on slack
from keras-vis.
There are a couple of things going on there.
-
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 settingpenultimate_layer_idx=3 or 2
. By default, it picks the lowest conv layer which has too small of an output resolution. -
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.
-
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.
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)
- [question] electrode contribution in EEG input
- Is there any reason why no demo for activation maximization for resnet?
- Is the project still maintained? HOT 2
- Exact gradient values
- Memory increases and iterations slow down while using visualize_saliency
- 3D MRI Image
- How to clip the positive gradients when using visualization_cam?
- AttributeError: module 'tensorflow' has no attribute 'get_default_graph' HOT 1
- AttributeError: 'list'/integer/float object has no attribute 'build_loss' in visualize_saliency_with_losses
- ImportError: cannot import name '_Conv' from 'keras.layers.convolutional' HOT 19
- Generated Image Color
- Issue - "ImportError: cannot import name '_Conv' from 'keras.layers.convolutional'" HOT 2
- Tensorflow version? HOT 1
- Problem with custom CNN VGG16 (unsupported operand type(s) for *: 'int' and 'NoneType')
- scipy 1.5.2 ImportError: cannot import name 'imresize' HOT 3
- Cannot convert a symbolic Keras input/output to a numpy array... HOT 1
- v
- Is this also working for Faster R-CNN or Mask R-CNN?
- Why is pre-activation output used for computing vanilla saliency map?
- AttributeError: module 'keras.utils.generic_utils' has no attribute 'populate_dict_with_module_objects'
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-vis.