You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
KeyError: "The name 'FID_Inception_Net/pool_3:0' refers to a Tensor which does not exist. The operation, 'FID_Inception_Net/pool_3', does not exist in the graph."
#42
Open
mzc0119 opened this issue
Feb 3, 2021
· 3 comments
/content/TTUR/fid.py in get_activations(images, sess, batch_size, verbose)
81 activations of the given tensor when feeding inception with the query tensor.
82 """
---> 83 inception_layer = _get_inception_layer(sess)
84 n_images = images.shape[0]
85 if batch_size > n_images:
/content/TTUR/fid.py in _get_inception_layer(sess)
47 """Prepares inception net for batched usage and returns pool_3 layer. """
48 layername = 'FID_Inception_Net/pool_3:0'
---> 49 pool3 = sess.graph.get_tensor_by_name(layername)
50 ops = pool3.graph.get_operations()
51 for op_idx, op in enumerate(ops):
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py in get_tensor_by_name(self, name)
3900 raise TypeError("Tensor names are strings (or similar), not %s." %
3901 type(name).name)
-> 3902 return self.as_graph_element(name, allow_tensor=True, allow_operation=False)
3903
3904 def _get_tensor_by_tf_output(self, tf_output):
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py in _as_graph_element_locked(self, obj, allow_tensor, allow_operation)
3766 raise KeyError("The name %s refers to a Tensor which does not "
3767 "exist. The operation, %s, does not exist in the "
-> 3768 "graph." % (repr(name), repr(op_name)))
3769 try:
3770 return op.outputs[out_n]
KeyError: "The name 'FID_Inception_Net/pool_3:0' refers to a Tensor which does not exist. The operation, 'FID_Inception_Net/pool_3', does not exist in the graph."
The text was updated successfully, but these errors were encountered:
I've fixed the issue by deleting "FID_Inception_Net" from create_inception_graph, _get_inception_layer, and get_activations. The problem is probably due to the Colab's different path.
I've fixed the issue by deleting "FID_Inception_Net" from create_inception_graph, _get_inception_layer, and get_activations. The problem is probably due to the Colab's different path.
Thanks a lot!
For people noob like me. Just use google's tf upgrade tool. Then whereever "FID_Inception_Net" is there. Change it to "FID_Inception_Net". If "FID_Inception_Net/something" then "something".
Hello, thanks for your wonderful work. I run in colab and I have met an error recently. but I don't know how to fix it.
Here is the whole message:
create inception graph.. ok
calculte FID stats..
KeyError Traceback (most recent call last)
in ()
6 with tf.compat.v1.Session() as Sess:
7 Sess.run(tf.compat.v1.global_variables_initializer())
----> 8 mu_gen, sigma_gen = fid.calculate_activation_statistics(images, Sess, batch_size=100)
9
10 fid.fid_value = calculate_frechet_distance(mu_gen, sigma_gen, mu_real, sigma_real)
5 frames
/content/TTUR/fid.py in calculate_activation_statistics(images, sess, batch_size, verbose)
178 the incption model.
179 """
--> 180 act = get_activations(images, sess, batch_size, verbose)
181 mu = np.mean(act, axis=0)
182 sigma = np.cov(act, rowvar=False)
/content/TTUR/fid.py in get_activations(images, sess, batch_size, verbose)
81 activations of the given tensor when feeding inception with the query tensor.
82 """
---> 83 inception_layer = _get_inception_layer(sess)
84 n_images = images.shape[0]
85 if batch_size > n_images:
/content/TTUR/fid.py in _get_inception_layer(sess)
47 """Prepares inception net for batched usage and returns pool_3 layer. """
48 layername = 'FID_Inception_Net/pool_3:0'
---> 49 pool3 = sess.graph.get_tensor_by_name(layername)
50 ops = pool3.graph.get_operations()
51 for op_idx, op in enumerate(ops):
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py in get_tensor_by_name(self, name)
3900 raise TypeError("Tensor names are strings (or similar), not %s." %
3901 type(name).name)
-> 3902 return self.as_graph_element(name, allow_tensor=True, allow_operation=False)
3903
3904 def _get_tensor_by_tf_output(self, tf_output):
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py in as_graph_element(self, obj, allow_tensor, allow_operation)
3724
3725 with self._lock:
-> 3726 return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
3727
3728 def _as_graph_element_locked(self, obj, allow_tensor, allow_operation):
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py in _as_graph_element_locked(self, obj, allow_tensor, allow_operation)
3766 raise KeyError("The name %s refers to a Tensor which does not "
3767 "exist. The operation, %s, does not exist in the "
-> 3768 "graph." % (repr(name), repr(op_name)))
3769 try:
3770 return op.outputs[out_n]
KeyError: "The name 'FID_Inception_Net/pool_3:0' refers to a Tensor which does not exist. The operation, 'FID_Inception_Net/pool_3', does not exist in the graph."
The text was updated successfully, but these errors were encountered: