Comments (2)
It can be tuned to your specific problem.
As long as you can specify a target cost function, you can use this.
I used this for visualizing the PilotNet network that outputs angles. This network is used for regression and not classification.
https://jacobgil.github.io/deeplearning/vehicle-steering-angle-visualizations
from keras-grad-cam.
InvalidArgumentError Traceback (most recent call last)
/home/pardha/anaconda3/envs/for_tensorflow/lib/python3.6/site-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
1326 try:
-> 1327 return fn(*args)
1328 except errors.OpError as e:
/home/pardha/anaconda3/envs/for_tensorflow/lib/python3.6/site-packages/tensorflow/python/client/session.py in _run_fn(session, feed_dict, fetch_list, target_list, options, run_metadata)
1305 feed_dict, fetch_list, target_list,
-> 1306 status, run_metadata)
1307
/home/pardha/anaconda3/envs/for_tensorflow/lib/python3.6/contextlib.py in exit(self, type, value, traceback)
88 try:
---> 89 next(self.gen)
90 except StopIteration:
/home/pardha/anaconda3/envs/for_tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py in raise_exception_on_not_ok_status()
465 compat.as_text(pywrap_tensorflow.TF_Message(status)),
--> 466 pywrap_tensorflow.TF_GetCode(status))
467 finally:
InvalidArgumentError: You must feed a value for placeholder tensor 'batch_normalization_1/keras_learning_phase' with dtype bool
[[Node: batch_normalization_1/keras_learning_phase = Placeholderdtype=DT_BOOL, shape=, _device="/job:localhost/replica:0/task:0/cpu:0"]]
During handling of the above exception, another exception occurred:
InvalidArgumentError Traceback (most recent call last)
in ()
1 for i,layer_name in enumerate([l.name for l in my_model.layers]):
----> 2 cam, heatmap = grad_cam(my_model, preprocessed_img, predicted_class, layer_name)
3 cam = cv2.cvtColor(cam, cv2.COLOR_BGR2RGB)
4 plt.figure(i)
5 plt.title(str(layer_name))
in grad_cam(input_model, image, category_index, layer_name)
14 gradient_function = K.function([model.layers[0].input], [conv_output, grads])
15 print('hellooooooooo',gradient_function)
---> 16 output, grads_val = gradient_function([image])
17 output, grads_val = output[0, :], grads_val[0, :, :, :]
18
/home/pardha/anaconda3/envs/for_tensorflow/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py in call(self, inputs)
2266 updated = session.run(self.outputs + [self.updates_op],
2267 feed_dict=feed_dict,
-> 2268 **self.session_kwargs)
2269 return updated[:len(self.outputs)]
2270
/home/pardha/anaconda3/envs/for_tensorflow/lib/python3.6/site-packages/tensorflow/python/client/session.py in run(self, fetches, feed_dict, options, run_metadata)
893 try:
894 result = self._run(None, fetches, feed_dict, options_ptr,
--> 895 run_metadata_ptr)
896 if run_metadata:
897 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)
/home/pardha/anaconda3/envs/for_tensorflow/lib/python3.6/site-packages/tensorflow/python/client/session.py in _run(self, handle, fetches, feed_dict, options, run_metadata)
1122 if final_fetches or final_targets or (handle and feed_dict_tensor):
1123 results = self._do_run(handle, final_targets, final_fetches,
-> 1124 feed_dict_tensor, options, run_metadata)
1125 else:
1126 results = []
/home/pardha/anaconda3/envs/for_tensorflow/lib/python3.6/site-packages/tensorflow/python/client/session.py in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)
1319 if handle is None:
1320 return self._do_call(_run_fn, self._session, feeds, fetches, targets,
-> 1321 options, run_metadata)
1322 else:
1323 return self._do_call(_prun_fn, self._session, handle, feeds, fetches)
/home/pardha/anaconda3/envs/for_tensorflow/lib/python3.6/site-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
1338 except KeyError:
1339 pass
-> 1340 raise type(e)(node_def, op, message)
1341
1342 def _extend_graph(self):
InvalidArgumentError: You must feed a value for placeholder tensor 'batch_normalization_1/keras_learning_phase' with dtype bool
[[Node: batch_normalization_1/keras_learning_phase = Placeholderdtype=DT_BOOL, shape=, _device="/job:localhost/replica:0/task:0/cpu:0"]]
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.