gpt4 book ai didi

python - 导出推理图时出错(ValueError)

转载 作者:太空宇宙 更新时间:2023-11-03 13:09:06 25 4
gpt4 key购买 nike

所以我正在学习 senddex 的对象检测教程,我已经到了应该导出推理图的步骤。我正在使用 Tensorflow 的 object_detection 文件夹中的“export_inference_graph.py”脚本。问题是我得到了这个 ValueError:

Traceback (most recent call last):
File "C:\Users\Zelcore-Dator\AppData\Local\Programs\Python\Python35\lib\site-packages\google\proto
buf\internal\python_message.py", line 545, in _GetFieldByName
return message_descriptor.fields_by_name[field_name]
KeyError: 'layout_optimizer'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "export_inference_graph.py", line 119, in <module>
tf.app.run()
File "C:\Users\Zelcore-Dator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\p
ython\platform\app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "export_inference_graph.py", line 115, in main
FLAGS.output_directory, input_shape)
File "C:\Users\Zelcore-Dator\AppData\Local\Programs\Python\Python35\lib\site-packages\object_detec
tion-0.1-py3.5.egg\object_detection\exporter.py", line 427, in export_inference_graph
input_shape, optimize_graph, output_collection_name)
File "C:\Users\Zelcore-Dator\AppData\Local\Programs\Python\Python35\lib\site-packages\object_detec
tion-0.1-py3.5.egg\object_detection\exporter.py", line 391, in _export_inference_graph
initializer_nodes='')
File "C:\Users\Zelcore-Dator\AppData\Local\Programs\Python\Python35\lib\site-packages\object_detec
tion-0.1-py3.5.egg\object_detection\exporter.py", line 72, in freeze_graph_with_def_protos
layout_optimizer=rewriter_config_pb2.RewriterConfig.ON)
File "C:\Users\Zelcore-Dator\AppData\Local\Programs\Python\Python35\lib\site-packages\google\proto
buf\internal\python_message.py", line 484, in init
field = _GetFieldByName(message_descriptor, field_name)
File "C:\Users\Zelcore-Dator\AppData\Local\Programs\Python\Python35\lib\site-packages\google\proto
buf\internal\python_message.py", line 548, in _GetFieldByName
(message_descriptor.name, field_name))
ValueError: Protocol message RewriterConfig has no "layout_optimizer" field.

我猜它与protobuf有关,但我已经重新安装了好几次都没有成功。感谢所有帮助

最佳答案

我也遇到过。几周前没有发生。在错误修复之前,您可以使用仍然有效的早期版本。替换“object_detection/exporter.py”中的第 72 行:

layout_optimizer=rewriter_config_pb2.RewriterConfig.ON)

使用旧的工作线:

optimize_tensor_layout=True)

关于python - 导出推理图时出错(ValueError),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48215159/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com