tensorflow / tensorflow/models

Error while importing the Frozen model to tensorflowjs

Open
#8,548 0 comments 0 reactions 3 assignees View on GitHub

@pkulzc is already working on this.

Since May 21, 2020.

models:research:odapi type:bug
Dominant language
Python
Stars
77.7k
Forks
44.8k
PR merge metrics
No merged PRs in 30d

Description

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am using the latest TensorFlow Model Garden release and TensorFlow 2.
  • I am reporting the issue to the correct repository. (Model Garden official or research directory)
  • I checked to make sure that this issue has not been filed already.

1. The entire URL of the file you are using

https://github.com/tensorflow/models/tree/master/official/...

2. Describe the bug

A clear and concise description of what the bug is.

3. Steps to reproduce

Steps to reproduce the behavior.

4. Expected behavior

A clear and concise description of what you expected to happen.

5. Additional context

Include any logs that would be helpful to diagnose the problem.

6. System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
  • Mobile device name if the issue happens on a mobile device:
  • TensorFlow installed from (source or binary):
  • TensorFlow version (use command below):
  • Python version:
  • Bazel version (if compiling from source):
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version:
  • GPU model and memory:

After exporting the graph , how do i import the frozen graph model created in the output directory in tensorflowjs . Looking at the standard documentation , the tensorflowjs_converter is to be used , but after it it always gives me an error that "KeyError: 'The name "'detection_boxes" refers to an Operation not in the graph.'"

Here is the conversion command below :

(tensorflowjs) c:>tensorflowjs_converter --input_format=tf_frozen_model --output_node_names='detection_boxes,detection_scores,detection_classes,num_detections' --saved_model_tags=serve C:/model_conv/inference_graph/frozen_inference_graph.pb C:/model_conv/inference_graph/web_model

and the Traceback call error below:

Traceback (most recent call last):
File "c:\programdata\anaconda3\envs\tensorflowjs\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\programdata\anaconda3\envs\tensorflowjs\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\ProgramData\Anaconda3\envs\tensorflowjs\Scripts\tensorflowjs_converter.exe_main.py", line 7, in
File "c:\programdata\anaconda3\envs\tensorflowjs\lib\site-packages\tensorflowjs\converters\converter.py", line 671, in pip_main
main([' '.join(sys.argv[1:])])
File "c:\programdata\anaconda3\envs\tensorflowjs\lib\site-packages\tensorflowjs\converters\converter.py", line 675, in main
convert(argv[0].split(' '))
File "c:\programdata\anaconda3\envs\tensorflowjs\lib\site-packages\tensorflowjs\converters\converter.py", line 653, in convert
tf_saved_model_conversion_v2.convert_tf_frozen_model(
File "c:\programdata\anaconda3\envs\tensorflowjs\lib\site-packages\tensorflowjs\converters\tf_saved_model_conversion_v2.py", line 388, in convert_tf_frozen_model
optimize_graph(graph, signature,
File "c:\programdata\anaconda3\envs\tensorflowjs\lib\site-packages\tensorflowjs\converters\tf_saved_model_conversion_v2.py", line 134, in optimize_graph
graph.add_to_collection('train_op', graph.get_operation_by_name(name))
File "c:\programdata\anaconda3\envs\tensorflowjs\lib\site-packages\tensorflow\python\framework\ops.py", line 3640, in get_operation_by_name
return self.as_graph_element(name, allow_tensor=False, allow_operation=True)
File "c:\programdata\anaconda3\envs\tensorflowjs\lib\site-packages\tensorflow\python\framework\ops.py", line 3512, in as_graph_element
return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
File "c:\programdata\anaconda3\envs\tensorflowjs\lib\site-packages\tensorflow\python\framework\ops.py", line 3571, in _as_graph_element_locked
raise KeyError("The name %s refers to an Operation not in the "
KeyError: 'The name "'detection_boxes" refers to an Operation not in the graph.'

My conda environment is:
(tensorflowjs) c:>pip list
Package Version

absl-py 0.9.0
astunparse 1.6.3
cachetools 4.1.0
certifi 2020.4.5.1
chardet 3.0.4
gast 0.3.3
google-auth 1.15.0
google-auth-oauthlib 0.4.1
google-pasta 0.2.0
grpcio 1.29.0
h5py 2.10.0
idna 2.9
Keras-Preprocessing 1.1.2
Markdown 3.2.2
numpy 1.18.4
oauthlib 3.1.0
opt-einsum 3.2.1
pip 20.0.2
prompt-toolkit 1.0.14
protobuf 3.11.3
pyasn1 0.4.8
pyasn1-modules 0.2.8
Pygments 2.6.1
PyInquirer 1.0.3
regex 2020.5.14
requests 2.23.0
requests-oauthlib 1.3.0
rsa 4.0
scipy 1.4.1
setuptools 46.4.0.post20200518
six 1.14.0
tensorboard 2.2.1
tensorboard-plugin-wit 1.6.0.post3
tensorflow-cpu 2.2.0
tensorflow-estimator 2.2.0
tensorflow-hub 0.7.0
tensorflowjs 1.7.4.post1
termcolor 1.1.0
urllib3 1.25.9
wcwidth 0.1.9
Werkzeug 1.0.1
wheel 0.34.2
wincertstore 0.2
wrapt 1.12.1

The environment in which object_detection_api was used is python=3.5 and tensorflow=1.5

Kindly Help , as I want to consume the trained model in tensorflowjs.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.