【问题标题】:protocol buffer error while creating annotations to my object detection project为我的对象检测项目创建注释时出现协议缓冲区错误
【发布时间】:2022-07-15 15:08:51
【问题描述】:

如何解决这个问题 我从来没有遇到过这种错误,找不到出路 请大家帮帮我

Traceback (most recent call last):
  File "D:\DK\Dev\Number-plate-detection\Tensorflow\scripts\generate_tfrecord.py", line 27, in <module>
    import tensorflow.compat.v1 as tf
  File "D:\DK\Dev\Number-plate-detection\npd\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "D:\DK\Dev\Number-plate-detection\npd\lib\site-packages\tensorflow\python\__init__.py", line 40, in <module>
    from tensorflow.python.eager import context
  File "D:\DK\Dev\Number-plate-detection\npd\lib\site-packages\tensorflow\python\eager\context.py", line 32, in <module>
    from tensorflow.core.framework import function_pb2
  File "D:\DK\Dev\Number-plate-detection\npd\lib\site-packages\tensorflow\core\framework\function_pb2.py", line 16, in <module>
    from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
  File "D:\DK\Dev\Number-plate-detection\npd\lib\site-packages\tensorflow\core\framework\attr_value_pb2.py", line 16, in <module>
    from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
  File "D:\DK\Dev\Number-plate-detection\npd\lib\site-packages\tensorflow\core\framework\tensor_pb2.py", line 16, in <module>
    from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2
  File "D:\DK\Dev\Number-plate-detection\npd\lib\site-packages\tensorflow\core\framework\resource_handle_pb2.py", line 16, in <module>
    from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
  File "D:\DK\Dev\Number-plate-detection\npd\lib\site-packages\tensorflow\core\framework\tensor_shape_pb2.py", line 36, in <module>
    _descriptor.FieldDescriptor(
  File "D:\DK\Dev\Number-plate-detection\npd\lib\site-packages\google\protobuf\descriptor.py", line 560, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).```

【问题讨论】:

    标签: python tensorflow


    【解决方案1】:

    通过将 protobuf 包降级到 3.20.x,您将不会收到此错误。您可以使用 pip install protobuf==3.20.x 降级 protobuf。谢谢!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-05-22
      • 2019-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-07-27
      • 2013-09-21
      相关资源
      最近更新 更多