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

Error while exporting inference graph. #2861

Closed
Vardan95 opened this issue Nov 21, 2017 · 18 comments
Closed

Error while exporting inference graph. #2861

Vardan95 opened this issue Nov 21, 2017 · 18 comments

Comments

@Vardan95
Copy link

Vardan95 commented Nov 21, 2017

After pulling repo (0cc9862) got an error on object_detection/export_inference_graph.py call.
Error message:

File "/home/ubuntu/models/research/object_detection/exporter.py", line 72, in 
  freeze_graph_with_def_protos optimize_tensor_layout=True)                                               
ValueError: Protocol message RewriterConfig has no "optimize_tensor_layout" field

TF version: latest nightly build

@llpassarelli
Copy link

llpassarelli commented Dec 8, 2017

some error on export_inference_graph.py (tf1.4, cuda9)
this changes in exporter.py not solve rewrite_options = rewriter_config_pb2.RewriterConfig(layout_optimizer=rewriter_config_pb2.RewriterConfig.ON)

File "export_inference_graph.py", line 119, in
tf.app.run()
File "/home/leo/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 129, in run
_sys.exit(main(argv))
File "export_inference_graph.py", line 115, in main
FLAGS.output_directory, input_shape)
File "/home/leo/tf/models/research/object_detection/exporter.py", line 427, in export_inference_graph
input_shape, optimize_graph, output_collection_name)
File "/home/leo/tf/models/research/object_detection/exporter.py", line 391, in _export_inference_graph
initializer_nodes='')
File "/home/leo/tf/models/research/object_detection/exporter.py", line 71, in freeze_graph_with_def_protos
rewrite_options = rewriter_config_pb2.RewriterConfig(optimize_tensor_layout=True,layout_optimizer=rewriter_config_pb2.RewriterConfig.ON)
File "/home/leo/.local/lib/python2.7/site-packages/google/protobuf/internal/python_message.py", line 496, in init
field = _GetFieldByName(message_descriptor, field_name)
File "/home/leo/.local/lib/python2.7/site-packages/google/protobuf/internal/python_message.py", line 560, in _GetFieldByName
(message_descriptor.name, field_name))
ValueError: Protocol message RewriterConfig has no "optimize_tensor_layout" field.

@crizzy9
Copy link

crizzy9 commented Dec 12, 2017

Getting the same error. Any solutions?

@mahyaar
Copy link

mahyaar commented Dec 18, 2017

I resolved it by removing "optimize_tensor_layout=True" from exporter.py line 71. It looks like a tensorflow bug but for now that worked.

@llpassarelli
Copy link

llpassarelli commented Dec 19, 2017

tks mahyarr, remove "optimize_tensor_layout=True" from exporter.py line 71. solved!!!

@dakshvar22
Copy link
Contributor

dakshvar22 commented Jan 4, 2018

Change the parameter on line 71 to layout_optimizer=1 . Made a PR - #3106

@Zelcore99
Copy link

Zelcore99 commented Jan 11, 2018

For me it still throws the error even though I'm using the current standard value for the parameter, any tips?

@frostell
Copy link

on ubuntu 16.04 with latest version of everything involved installed I got the same error:

ValueError: Protocol message RewriterConfig has no "layout_optimizer" field.

I changed "layout_optimizer" to "optimize_tensor_layout" on line 72 in exporter.py, and then it worked.

(I'm guessing that RewriterConfig needs to be updated if the desired name of the field is "layout_optimizer" and not "optimize_tensor_layout")

@Zelcore99
Copy link

Hmm, I tried changing line 72 to that but I still get the exact same error lol. There has to be some weird stuff going on for me right now...

@ThomasLengeling
Copy link

@frostell that work, thank you!!!

@mekimv
Copy link

mekimv commented Jan 16, 2018

On Ubuntu 16.04; Changing layout_optimizer in export.py didn't fix the problem, I still get the error:

ValueError: Protocol message RewriterConfig has no "layout_optimizer" field.

@frostell How can I update RewiterConfig? Thanks in advance

@P-a-i-s
Copy link

P-a-i-s commented Jan 17, 2018

thanks @frostell - faced the same problem and it worked well for me!

@bkowshik
Copy link

bkowshik commented Jan 17, 2018

Thank you @frostell 🤗

The fix you suggested did it for me too. During my initial setup, I had to run the following commands referenced from the link below:

cd model/research/

python setup.py build
python setup.py install

So, once I applied the fix you suggested, and re-run ^ commands to get the export working.

@MicrocontrollersAndMore
Copy link

MicrocontrollersAndMore commented Jan 17, 2018

Using the stock tensorflow models clone I'm getting the same error pretty much everybody else here is describing. While attempting to follow this tutorial series:

https://www.youtube.com/playlist?list=PLQVvvaa0QuDcNK5GeCQnxYnSSaar2tpku

In the 6th video, when I run export_inference_graph.py with the stock tensorflow models clone, I get this error:

ValueError: Protocol message RewriterConfig has no "layout_optimizer" field.

If I change models/research/object_detection/exporter.py line 71/72 from

rewrite_options = rewriter_config_pb2.RewriterConfig(
          layout_optimizer=rewriter_config_pb2.RewriterConfig.ON)

to

rewrite_options = rewriter_config_pb2.RewriterConfig()

and I don't change anything else whatsoever and run it again then it works.

I'm running Windows 10, TensorFlow 1.4, and I cloned tensorflow models and performed the protobuf compile this past weekend so I'm confident they are both current.

Somebody at google please fix this asap.

@RoboEvangelist
Copy link

I also changed "layout_optimizer" to "optimize_tensor_layout" on line 72 in exporter.py, and then it worked.

However, why has this problem not been fixed?

Thanks,

@frostell
Copy link

frostell commented Feb 3, 2018

ok, seems like the RewriterConfig has been changed in tensorflow 1.5 and the small modification detailed above will make it brake in the same manner but with the opposite result (I had to change back from the small mod when I updated to 1.5)

what will work is:

Tensorflow version 1.4
"optimize_tensor_layout" on line 72 in exporter.py

Tensorflow version 1.5
"layout_optimizer" on line 72 in exporter.py

@aysark
Copy link
Contributor

aysark commented Feb 7, 2018

@frostell thanks that fixed it!

@willSapgreen
Copy link

@frostell, thank you that fixed it on

Ubuntu 16.04.01 LTS
Tensorflow 1.4.1

gauthiermartin added a commit to sonia-auv/deep_training that referenced this issue Apr 22, 2018
dozzer pushed a commit to dozzer/Object-Detection-Quidditch that referenced this issue Oct 1, 2018
@wt-huang
Copy link

Closing as this is resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.