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

'label', does not exist in the graph #57

Closed
ghost opened this issue Feb 8, 2020 · 9 comments
Closed

'label', does not exist in the graph #57

ghost opened this issue Feb 8, 2020 · 9 comments

Comments

@ghost
Copy link

ghost commented Feb 8, 2020

@zhang0jhon
When running test.py with the model, i get error:

 Traceback (most recent call last):
  File "test.py", line 121, in <module>
    test(args)
  File "test.py", line 91, in test
    model = TextRecognition(args.pb_path, cfg.seq_len+1)
  File "test.py", line 23, in __init__
    self.init_model()
  File "test.py", line 37, in init_model
    self.label_ph = self.sess.graph.get_tensor_by_name('label:0')
  File "/home/home/anaconda3/envs/p3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3972, in get_tensor_by_name
    return self.as_graph_element(name, allow_tensor=True, allow_operation=False)
  File "/home/home/anaconda3/envs/p3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3796, in as_graph_element
    return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
  File "/home/home/anaconda3/envs/p3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3838, in _as_graph_element_locked
    "graph." % (repr(name), repr(op_name)))
KeyError: "The name 'label:0' refers to a Tensor which does not exist. The operation, 'label', does not exist in the graph."
@mayidu
Copy link

mayidu commented Mar 17, 2020

您好,请问这个我问题您解决了吗?

@ghost
Copy link
Author

ghost commented Mar 17, 2020

no

@Tian14267
Copy link

请问你们有数据吗?我出现以下错误:
[Errno 2] No such file or directory: './data/lsvt/train_full_labels.json'
'lsvt/train_full_labels.json' 和 'art/train_task2_labels.json' 这些数据该怎么获取啊
@deepseek @mayidu

@JianYang93
Copy link

As the author mentioned in issue #7 , the reason for this error is that the model in the docker image is slightly different with the model in this repository. Therefore, directly using that pretrained model here will cause problem.

After trying for a whole day, I figured out a way to use the pretrain model. That is
(1) pulling the whole model from the docker image instead of using this repository
(2) writing a simple script utilizing the 'detection' function defined in flaskapp.py to do detection and recognition
During (2) I found I have to modify flaskapp.py in two ways: line 36 werkzeug to werkzeug.utils and line 71 add allow_pickle=True

It would be great that the author can either put the pretrained model for this repository here or change the code here to the docker version so we could use the pretrained model in a convenient way.

@etatbak
Copy link

etatbak commented May 1, 2020

As the author mentioned in issue #7 , the reason for this error is that the model in the docker image is slightly different with the model in this repository. Therefore, directly using that pretrained model here will cause problem.

After trying for a whole day, I figured out a way to use the pretrain model. That is
(1) pulling the whole model from the docker image instead of using this repository
(2) writing a simple script utilizing the 'detection' function defined in flaskapp.py to do detection and recognition
During (2) I found I have to modify flaskapp.py in two ways: line 36 werkzeug to werkzeug.utils and line 71 add allow_pickle=True

It would be great that the author can either put the pretrained model for this repository here or change the code here to the docker version so we could use the pretrained model in a convenient way.

@JianYang93 Did you menage to run the code? Can you please share the script?

@etatbak
Copy link

etatbak commented May 1, 2020

As the author mentioned in issue #7 , the reason for this error is that the model in the docker image is slightly different with the model in this repository. Therefore, directly using that pretrained model here will cause problem.
After trying for a whole day, I figured out a way to use the pretrain model. That is
(1) pulling the whole model from the docker image instead of using this repository
(2) writing a simple script utilizing the 'detection' function defined in flaskapp.py to do detection and recognition
During (2) I found I have to modify flaskapp.py in two ways: line 36 werkzeug to werkzeug.utils and line 71 add allow_pickle=True
It would be great that the author can either put the pretrained model for this repository here or change the code here to the docker version so we could use the pretrained model in a convenient way.

@JianYang93 Did you menage to run the code? Can you please share the script?

I got it thanks!

@Dilemma90
Copy link

@zhang0jhon
When running test.py with the model, i get error:

 Traceback (most recent call last):
  File "test.py", line 121, in <module>
    test(args)
  File "test.py", line 91, in test
    model = TextRecognition(args.pb_path, cfg.seq_len+1)
  File "test.py", line 23, in __init__
    self.init_model()
  File "test.py", line 37, in init_model
    self.label_ph = self.sess.graph.get_tensor_by_name('label:0')
  File "/home/home/anaconda3/envs/p3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3972, in get_tensor_by_name
    return self.as_graph_element(name, allow_tensor=True, allow_operation=False)
  File "/home/home/anaconda3/envs/p3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3796, in as_graph_element
    return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
  File "/home/home/anaconda3/envs/p3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3838, in _as_graph_element_locked
    "graph." % (repr(name), repr(op_name)))
KeyError: "The name 'label:0' refers to a Tensor which does not exist. The operation, 'label', does not exist in the graph."

请问你解决这个问题了嘛?

@JoelUser
Copy link

I have the same error and I don't know how to fix it I am using: test.py with text_recognition_5435.pb

Traceback (most recent call last): File "test.py", line 121, in <module> test(args) File "test.py", line 91, in test model = TextRecognition(args.pb_path, cfg.seq_len+1) File "test.py", line 23, in __init__ self.init_model() File "test.py", line 37, in init_model self.label_ph = self.sess.graph.get_tensor_by_name('label:0') File "C:\Users\Frank\Anaconda3\lib\site-packages\tensorflow_core\python\framework\ops.py", line 3681, in get_tensor_by_name return self.as_graph_element(name, allow_tensor=True, allow_operation=False) File "C:\Users\Frank\Anaconda3\lib\site-packages\tensorflow_core\python\framework\ops.py", line 3505, in as_graph_element return self._as_graph_element_locked(obj, allow_tensor, allow_operation) File "C:\Users\Frank\Anaconda3\lib\site-packages\tensorflow_core\python\framework\ops.py", line 3547, in _as_graph_element_locked "graph." % (repr(name), repr(op_name))) KeyError: "The name 'label:0' refers to a Tensor which does not exist. The operation, 'label', does not exist in the graph."

@ghost ghost closed this as completed Aug 21, 2020
@whereitogo
Copy link

@zhang0jhon
When running test.py with the model, i get error:

 Traceback (most recent call last):
  File "test.py", line 121, in <module>
    test(args)
  File "test.py", line 91, in test
    model = TextRecognition(args.pb_path, cfg.seq_len+1)
  File "test.py", line 23, in __init__
    self.init_model()
  File "test.py", line 37, in init_model
    self.label_ph = self.sess.graph.get_tensor_by_name('label:0')
  File "/home/home/anaconda3/envs/p3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3972, in get_tensor_by_name
    return self.as_graph_element(name, allow_tensor=True, allow_operation=False)
  File "/home/home/anaconda3/envs/p3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3796, in as_graph_element
    return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
  File "/home/home/anaconda3/envs/p3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3838, in _as_graph_element_locked
    "graph." % (repr(name), repr(op_name)))
KeyError: "The name 'label:0' refers to a Tensor which does not exist. The operation, 'label', does not exist in the graph."

hey,if you load the model,then print the network you will know how to modify the code! good luck!

This issue was closed.
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

7 participants