加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

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

发布时间:2020-12-20 12:05:21 所属栏目:Python 来源:网络整理
导读:所以我正在关注sentdex的对象检测教程,我已经到了你应该导出推理图的步骤.我正在使用Tensorflow的object_detection文件夹中的“export_inference_graph.py”脚本. 问题是我得到了这个ValueError: Traceback (most recent call last): File "C:UsersZelcor
所以我正在关注sentdex的对象检测教程,我已经到了你应该导出推理图的步骤.我正在使用Tensorflow的object_detection文件夹中的“export_inference_graph.py”脚本.
问题是我得到了这个ValueError:

Traceback (most recent call last):
  File "C:UsersZelcore-DatorAppDataLocalProgramsPythonPython35libsite-packagesgoogleproto
bufinternalpython_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:UsersZelcore-DatorAppDataLocalProgramsPythonPython35libsite-packagestensorflowp
ythonplatformapp.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:UsersZelcore-DatorAppDataLocalProgramsPythonPython35libsite-packagesobject_detec
tion-0.1-py3.5.eggobject_detectionexporter.py",line 427,in export_inference_graph
    input_shape,optimize_graph,output_collection_name)
  File "C:UsersZelcore-DatorAppDataLocalProgramsPythonPython35libsite-packagesobject_detec
tion-0.1-py3.5.eggobject_detectionexporter.py",line 391,in _export_inference_graph
    initializer_nodes='')
  File "C:UsersZelcore-DatorAppDataLocalProgramsPythonPython35libsite-packagesobject_detec
tion-0.1-py3.5.eggobject_detectionexporter.py",line 72,in freeze_graph_with_def_protos
    layout_optimizer=rewriter_config_pb2.RewriterConfig.ON)
  File "C:UsersZelcore-DatorAppDataLocalProgramsPythonPython35libsite-packagesgoogleproto
bufinternalpython_message.py",line 484,in init
    field = _GetFieldByName(message_descriptor,field_name)
  File "C:UsersZelcore-DatorAppDataLocalProgramsPythonPython35libsite-packagesgoogleproto
bufinternalpython_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)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读