Comments (7)
Just letting you guys know that I looked into it. I have it fixed but i ended up making a whole bunch of efficiency improvements which i plan to get out together. I will try my best to get it wrapped up this weekend.
from keras-vis.
In the file visualization.py
under vis/utils
directory which is based on your python site-package installation path,
I have made a change from
grads /= np.max(grads)
to
grads = np.true_divide(grads, np.max(grads))
However, I got a bug complained about:
heatmap = cv2.applyColorMap(cv2.GaussianBlur(grads * 255, (3, 3), 0), cv2.COLORMAP_JET)
error: /Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/colormap.cpp:501: error: (-5) cv::ColorMap only supports source images of type CV_8UC1 or CV_8UC3 in function operator()
on the line
any idea?
Update: I just made a change by changing from
heatmap = cv2.applyColorMap(cv2.GaussianBlur(grads * 255, (3, 3), 0), cv2.COLORMAP_JET)
to
heatmap = cv2.applyColorMap(cv2.GaussianBlur(grads.astype(np.uint8) * 255, (3, 3), 0), cv2.COLORMAP_JET)
from keras-vis.
Which version of numpy are you using? I cant reproduce this. Perhaps try a newer version of numpy?
The tests runs this example and its passing.
from keras-vis.
Thanks for the quick response!
I'm using 1.12.1
, but still isn't working.
Is there something else I can provide to help debug?
from keras-vis.
I also had the same error. Looks like numpy had a breaking change in their API: numpy/numpy#6464
My script also complained about missing a imagenet_class_index.json
file. Here's the traceback:
Traceback (most recent call last):
File "try.py", line 35, in <module>
heatmap = visualize_saliency(model, layer_idx, [pred_class], seed_img, text=utils.get_imagenet_label(pred_class))
File "/Users/andy/anaconda/lib/python3.5/site-packages/vis/utils/utils.py", line 185, in get_imagenet_label
with open(os.path.join(os.path.dirname(__file__), '../../resources/imagenet_class_index.json')) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/andy/anaconda/lib/python3.5/site-packages/vis/utils/../../resources/imagenet_class_index.json'
Looks like there's an extra ..
in the path? I did find the json file here, but the path should be vis/utils/../resources/imagenet_class_index.json
: https://github.com/raghakot/keras-vis/blob/master/resources/imagenet_class_index.json
from keras-vis.
Sorry this took a while. I just pushed a bunch of updates. These issues should now be fixed.
from keras-vis.
Feel free to reopen if you continue to see the issue,
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.