成功解决TypeError: __init__() got an unexpected keyword argument 'serialized_options'

简介: 成功解决TypeError: __init__() got an unexpected keyword argument 'serialized_options'

解决问题


TypeError: __init__() got an unexpected keyword argument 'serialized_options'


 File "object_detection/builders/model_builder_test.py", line 24, in <module>

   from object_detection.builders import model_builder

 File "F:\File_Python\Python_example\models-master\research\object_detection\builders\model_builder.py", line 20, in <module>

   from object_detection.builders import anchor_generator_builder

 File "F:\File_Python\Python_example\models-master\research\object_detection\builders\anchor_generator_builder.py", line 21, in <module>

   from object_detection.protos import anchor_generator_pb2

 File "F:\File_Python\Python_example\models-master\research\object_detection\protos\anchor_generator_pb2.py", line 15, in <module>

   from object_detection.protos import grid_anchor_generator_pb2 as object__detection_dot_protos_dot_grid__anchor__generator__pb2

 File "F:\File_Python\Python_example\models-master\research\object_detection\protos\grid_anchor_generator_pb2.py", line 22, in <module>

   serialized_pb=_b('\n3object_detection/protos/grid_anchor_generator.proto\x12\x17object_detection.protos\"\xcd\x01\n\x13GridAnchorGenerator\x12\x13\n\x06height\x18\x01 \x01(\x05:\x03\x32\x35\x36\x12\x12\n\x05width\x18\x02 \x01(\x05:\x03\x32\x35\x36\x12\x19\n\rheight_stride\x18\x03 \x01(\x05:\x02\x31\x36\x12\x18\n\x0cwidth_stride\x18\x04 \x01(\x05:\x02\x31\x36\x12\x18\n\rheight_offset\x18\x05 \x01(\x05:\x01\x30\x12\x17\n\x0cwidth_offset\x18\x06 \x01(\x05:\x01\x30\x12\x0e\n\x06scales\x18\x07 \x03(\x02\x12\x15\n\raspect_ratios\x18\x08 \x03(\x02')

TypeError: __init__() got an unexpected keyword argument 'serialized_options'



解决思路


类型错误:__init__()得到意外的关键字参数“serialized_options”


出现该问题,很有可能是,终端上的 protoc 版本 与python库内的protobuf版本不一样。




解决方法


安装对应版本的库即可!比如我的执行下列命令


pip install -U protobuf




大功告成!完美解决!


相关文章
|
5月前
|
开发者 Python
【Python】已解决:TypeError: __init__() got an unexpected keyword argument ‘port’
【Python】已解决:TypeError: __init__() got an unexpected keyword argument ‘port’
691 0
【Python】已解决:TypeError: __init__() got an unexpected keyword argument ‘port’
成功解决TypeError: ‘encoding’ is an invalid keyword argument for this function
成功解决TypeError: ‘encoding’ is an invalid keyword argument for this function
|
5月前
|
机器学习/深度学习 Python
【Python】已解决TypeError: init() got an unexpected keyword argument ‘threshold’
【Python】已解决TypeError: init() got an unexpected keyword argument ‘threshold’
160 0
|
5月前
|
Web App开发 测试技术 API
【Python】已解决:TypeError: *init*() got an unexpected keyword argument ‘firefox_options’
【Python】已解决:TypeError: *init*() got an unexpected keyword argument ‘firefox_options’
83 0
|
5月前
|
Python
【Python】已解决:TypeError: *init*() missing 1 required positional argument: ‘scheme’
【Python】已解决:TypeError: *init*() missing 1 required positional argument: ‘scheme’
315 0
npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror Error: Missing required argument #1
760 0
TypeError: custom() got an unexpected keyword argument ‘path‘
TypeError: custom() got an unexpected keyword argument ‘path‘
153 0
|
计算机视觉
成功解决TypeError: __init__() got an unexpected keyword argument 'n_iterations'
成功解决TypeError: __init__() got an unexpected keyword argument 'n_iterations'
|
机器学习/深度学习 Windows
raise RuntimeError(‘Error(s) in loading state_dict for {}:\n\t{}‘.format( RuntimeError: Error(s)..报错
即load_state_dict(fsd,strict=False) 属性strict;当strict=True,要求预训练练权重层数的键值与新构建的模型中的权重层数名称完全吻合;
1548 0
|
Dart 前端开发 JavaScript
Syntax Error: TypeError: this.getOptions is not a function
Syntax Error: TypeError: this.getOptions is not a function
536 0
Syntax Error: TypeError: this.getOptions is not a function