- 我在一个常见的集成学习范式中训练多个模型,目前我在处理几个检测器,每次训练时我都需要编辑每个检测器的配置文件,这显然会引起混淆,并且有几次我开始使用错误的配置文件进行训练。
- 作为解决方案,我正在尝试构建一个Google对象检测API配置文件的编辑器。配置文件使用Google Protocol Buffer。
- 我使用的文件链接:pipeline.proto, object_detection/protos, 示例 .config文件
我尝试了以下代码:
from object_detection.protos import input_reader_pb2with open('/models/research/object_detection/samples/configs/ssd_resnet50_v1_fpn_shared_box_predictor_640x640_coco14_sync.config', 'rb') as f: config = f.read()read = input_reader_pb2.InputReader().ParseFromString(config)
我得到了以下错误:
exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-19-8043e6bb108f>", line 1, in <module> input_reader_pb2.InputReader().ParseFromString(txt)google.protobuf.message.DecodeError: Error parsing message
我在这里遗漏了什么?解析和编辑配置文件的正确方法是什么?
谢谢,
Hod
回答:
使用以下代码,我能够解析配置文件。
参考自 这里