Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can this be problem Specific? #6

Open
pGit1 opened this issue Feb 26, 2017 · 2 comments
Open

Can this be problem Specific? #6

pGit1 opened this issue Feb 26, 2017 · 2 comments

Comments

@pGit1
Copy link

pGit1 commented Feb 26, 2017

Does this implementation only work with ImageNet like images or can it be tuned to your specific problem?

@jacobgil
Copy link
Owner

jacobgil commented Jun 1, 2017

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

@pardha-fission
Copy link

pardha-fission commented Dec 8, 2017

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"]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants