how to solve it?thanks.
hi @OldSaltyFishGo I got the same error. Did you know how to fix it? Thanks
Update: After I retrained the cmu network, input node (image) were renamed to split. Therefore, 'TfPoseEstimator/image', does not exist in the graph. The solution is to change TfPoseEstimator/image in estimator.py to TfPoseEstimator/split.
I got the same error. Did you know how to fix it? Thanks @OldSaltyFishGo @nvnnghia
hi @quchang3 The solution is to change TfPoseEstimator/image in estimator.py to TfPoseEstimator/split
Thanks for your reply.
When I retrained the CMU,I get checkpoints like this ,meta,ckpt,data. Before I run eval.py, I want to get graph.pb.
then i run run_checkpoint.py, and the network.py is
if sess_for_load is not None:
if type == 'cmu' or type == 'vgg':
if not os.path.isfile(pretrain_path_full):
raise Exception('Model file doesn\'t exist, path=%s' % pretrain_path_full)
net.load(os.path.join(_get_base_path(), pretrain_path), sess_for_load)
else:
s = '%dx%d' % (placeholder_input.shape[2], placeholder_input.shape[1])
ckpts = {
'mobilenet': 'trained/mobilenet_%s/model-246038' % s,
'mobilenet_thin': 'trained/mobilenet_thin_%s/model-449003' % s,
'mobilenet_fast': 'trained/mobilenet_fast_%s/model-189000' % s,
'mobilenet_accurate': 'trained/mobilenet_accurate/model-170000'
}
how to connect the checkpoint with pb , a newly numpy/openpose_coco.npy??
I have trouble in generating the pb with CMU model . could you give me a example??thanks. @nvnnghia
Put this code in your model dir and run.
`import tensorflow as tf
meta_path = 'model-18303.meta' # Your .meta file
output_node_names = ['Openpose/concat_stage7'] # Output nodes
with tf.Session() as sess:
# Restore the graph
saver = tf.train.import_meta_graph(meta_path)
# Load weights
saver.restore(sess,tf.train.latest_checkpoint('.'))
# Freeze the graph
frozen_graph_def = tf.graph_util.convert_variables_to_constants(
sess,
sess.graph_def,
output_node_names)
# Save the frozen graph
with open('output_graph.pb', 'wb') as f:
f.write(frozen_graph_def.SerializeToString())`
Hello, I downloaded the model of cmu from the Internet, I don鈥檛 know why this error occurs.@nvnnghia @quchang3
I am also meeting this issue. Not solved yet. It seems that the cmu graph doesn't work. Then I just change model to mobilenet_thin or the others. Just like this. It works.
$ roslaunch tfpose_ros demo_video.launch model:=mobilenet_thin
I've had the same issue on Ubuntu 18.04, even though the code was running perfectly fine on OSX with the exact same versions of dependencies.
I pinned down that the issue was manifesting itself in estimator.py's
` tf.import_graph_def(graph_def,name='TfPoseEstimator')
self.persistent_sess = tf.compat.v1.Session(graph=self.graph, config=tf_config)
for ts in [n.name for n in tf.compat.v1.get_default_graph().as_graph_def().node]:
print(ts)
self.tensor_image = self.graph.get_tensor_by_name('TfPoseEstimator/image:0')
self.tensor_output = self.graph.get_tensor_by_name('TfPoseEstimator/Openpose/concat_stage7:0')`
The output of print(ts) showed that the name 'TfPoseEstimator' was not appended to the graph correctly. As a result of that, the lines "get_tensor_by_name" could not have matched with any existing tensor.
Deleting the name also failed. In that case, another error occurs:
"TypeError: An op outside of the function building code is being passed a "Graph" tensor. It is possible to have Graph tensors leak out of the function building context by including atf.init_scope in your function building code."
A suggestion from tensorflow github issue worked for me - just paste the following under where you import tensorflow to disable eager execution.
tf.compat.v1.disable_eager_execution()
Hello! I met the same problem but solved this by simply changing graph.get_tensor_by_name('TfPoseEstimator/image:0') to graph.get_tensor_by_name(image:0'). Hope this could help :)
Hello! I met the same problem but solved this by simply changing
graph.get_tensor_by_name('TfPoseEstimator/image:0')tograph.get_tensor_by_name(image:0'). Hope this could help :)
F:\Position Estimation\tf-pose-estimation\tf_pose\estimator.py in __init__(self, graph_path, target_size, tf_config, trt_bool)
338 print(ts)
339 self.tensor_image = self.graph.get_tensor_by_name('image :0')
--> 340 self.tensor_output = self.graph.get_tensor_by_name('Openpose/concat_stage7:0')
341 self.tensor_heatMat = self.tensor_output[:, :, :, :19]
342 self.tensor_pafMat = self.tensor_output[:, :, :, 19:]
Hello, I tried as you said but its still giving me the same error.
"The name 'TfPoseEstimator/image:0' refers to a Tensor which does not exist. The operation, 'TfPoseEstimator/image', does not exist in the graph."
I've had the same issue on Ubuntu 18.04, even though the code was running perfectly fine on OSX with the exact same versions of dependencies.
I pinned down that the issue was manifesting itself inestimator.py's` tf.import_graph_def(graph_def,name='TfPoseEstimator')
self.persistent_sess = tf.compat.v1.Session(graph=self.graph, config=tf_config)for ts in [n.name for n in tf.compat.v1.get_default_graph().as_graph_def().node]: print(ts) self.tensor_image = self.graph.get_tensor_by_name('TfPoseEstimator/image:0') self.tensor_output = self.graph.get_tensor_by_name('TfPoseEstimator/Openpose/concat_stage7:0')`The output of
print(ts)showed that the name 'TfPoseEstimator' was not appended to the graph correctly. As a result of that, the lines "get_tensor_by_name" could not have matched with any existing tensor.Deleting the name also failed. In that case, another error occurs:
"TypeError: An op outside of the function building code is being passed a "Graph" tensor. It is possible to have Graph tensors leak out of the function building context by including atf.init_scope in your function building code."A suggestion from tensorflow github issue worked for me - just paste the following under where you import tensorflow to disable eager execution.
tf.compat.v1.disable_eager_execution()
This works for me !
Thx for saving the time!
I try to modify L337 :
self.tensor_image = self.graph.get_tensor_by_name('TfPoseEstimator/image:0')
self.tensor_output = self.graph.get_tensor_by_name('TfPoseEstimator/Openpose/concat_stage7:0')
to
self.tensor_image = self.graph.get_tensor_by_name('image:0')
self.tensor_output = self.graph.get_tensor_by_name('Openpose/concat_stage7:0')
but new problem occurs....
Only by adding at the begging of estimator.py
tf.compat.v1.disable_eager_execution()
everythings works well !!!!
I am having this issue when I try to run it on google colab. Please help!
I used https://netron.app/ to visualize the frozen_graph.pb and there was no image node in the graph. As @nvnnghia suggested, I then renamed image:0 to split:0 and it worked.
Most helpful comment
I've had the same issue on Ubuntu 18.04, even though the code was running perfectly fine on OSX with the exact same versions of dependencies.
I pinned down that the issue was manifesting itself in
estimator.py's` tf.import_graph_def(graph_def,name='TfPoseEstimator')
self.persistent_sess = tf.compat.v1.Session(graph=self.graph, config=tf_config)
The output of
print(ts)showed that the name 'TfPoseEstimator' was not appended to the graph correctly. As a result of that, the lines "get_tensor_by_name" could not have matched with any existing tensor.Deleting the name also failed. In that case, another error occurs:
"TypeError: An op outside of the function building code is being passed a "Graph" tensor. It is possible to have Graph tensors leak out of the function building context by including atf.init_scope in your function building code."A suggestion from tensorflow github issue worked for me - just paste the following under where you import tensorflow to disable eager execution.
tf.compat.v1.disable_eager_execution()