First of all, great job on this library.
I tried to implement this myself, but this repository saved me a lot of time.
I am trying to use all visualizations functions, but I seem to only get the activation_visualization working to work.
The code i use for my activation visualization (which works properly):
with detection_graph.as_default():
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
image = Image.open("0064.jpg")
image_np = load_image_into_numpy_array(image)
image_tensor = tf.get_default_graph().get_tensor_by_name('image_tensor:0')
tf_cnnvis.activation_visualization(sess_graph_path = None, value_feed_dict={image_tensor:np.expand_dims(image_np, 0)} , layers=layers , path_logdir='LogDiff', path_outdir='OutputDiff')
sess.close()
Now when using this same code for deconv_visualization:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-9-ac0615204cc9> in <module>()
5 image_np = load_image_into_numpy_array(image)
6 image_tensor = tf.get_default_graph().get_tensor_by_name('image_tensor:0')
----> 7 tf_cnnvis.deconv_visualization(sess_graph_path = None, value_feed_dict={image_tensor:np.expand_dims(image_np, 0)} , layers=layers , path_logdir='LogDeconv', path_outdir='OutputDeconv')
8 sess.close()
c:\users\berger\appdata\local\continuum\anaconda3\envs\tensorflow-gpu\lib\site-packages\tf_cnnvis-1.0.0-py3.5.egg\tf_cnnvis\tf_cnnvis.py in deconv_visualization(sess_graph_path, value_feed_dict, input_tensor, layers, path_logdir, path_outdir)
408 def deconv_visualization(sess_graph_path, value_feed_dict, input_tensor = None, layers = 'r', path_logdir = './Log', path_outdir = "./Output"):
409 is_success = _get_visualization(sess_graph_path, value_feed_dict, input_tensor = input_tensor, layers = layers, method = "deconv",
--> 410 path_logdir = path_logdir, path_outdir = path_outdir)
411 return is_success
412
c:\users\berger\appdata\local\continuum\anaconda3\envs\tensorflow-gpu\lib\site-packages\tf_cnnvis-1.0.0-py3.5.egg\tf_cnnvis\tf_cnnvis.py in _get_visualization(sess_graph_path, value_feed_dict, input_tensor, layers, path_logdir, path_outdir, method)
137 # None input defaults to the default session if available, to the default graoh otherwise.
138 if isinstance(tf.get_default_session(), tf.Session):
--> 139 PATH = _save_model(tf.get_default_session())
140 else:
141 PATH = _save_model(tf.get_default_graph())
c:\users\berger\appdata\local\continuum\anaconda3\envs\tensorflow-gpu\lib\site-packages\tf_cnnvis-1.0.0-py3.5.egg\tf_cnnvis\tf_cnnvis.py in _save_model(graph_or_sess)
75 PATH = os.path.join("model", "tmp-model")
76 make_dir(path = os.path.dirname(PATH))
---> 77 saver = tf.train.Saver()
78 #i should deal with the case in which sess is closed.
79 saver.save(sess, PATH)
c:\users\berger\appdata\local\continuum\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\training\saver.py in __init__(self, var_list, reshape, sharded, max_to_keep, keep_checkpoint_every_n_hours, name, restore_sequentially, saver_def, builder, defer_build, allow_empty, write_version, pad_step_number, save_relative_paths, filename)
1237 self._filename = filename
1238 if not defer_build and context.in_graph_mode():
-> 1239 self.build()
1240 if self.saver_def:
1241 self._check_saver_def()
c:\users\berger\appdata\local\continuum\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\training\saver.py in build(self)
1246 if context.in_eager_mode():
1247 raise RuntimeError("Use save/restore instead of build in eager mode.")
-> 1248 self._build(self._filename, build_save=True, build_restore=True)
1249
1250 def _build_eager(self, checkpoint_path, build_save, build_restore):
c:\users\berger\appdata\local\continuum\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\training\saver.py in _build(self, checkpoint_path, build_save, build_restore)
1270 return
1271 else:
-> 1272 raise ValueError("No variables to save")
1273 self._is_empty = False
1274
ValueError: No variables to save
In your example you pass both functions the same arguments, so is this the right approach or should I change some of my argument in the deconv_visualization?
More general, can you help me fixing this error?
Hey,
First of all, great job on this library. I tried to implement this myself, but this repository saved me a lot of time.
I am trying to use all visualizations functions, but I seem to only get the activation_visualization working to work. The code i use for my activation visualization (which works properly):
Now when using this same code for deconv_visualization:
I receive the following error:
In your example you pass both functions the same arguments, so is this the right approach or should I change some of my argument in the deconv_visualization? More general, can you help me fixing this error?
Thanks in advance!
Kind regards,
Roy