ValueError:协议消息SsdFeatureExtractor没有字段replace_preprocessor_with_placeholder

时间:2019-04-13 20:43:12

标签: python-3.x tensorflow object-detection-api

我正在使用对象检测API来训练自己的模型,但是在使用以下命令运行训练时:

python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_coco.config

我收到此错误:

WARNING:tensorflow:From C:\Users\MHD\Anaconda3\envs\tf15\lib\site-packages\tensorflow\python\platform\app.py:124: main (from __main__) is deprecated and will be removed in a future version. Instructions for updating: Use object_detection/model_main.py. Traceback (most recent call last): File "train.py", line 179, in <module> tf.app.run() File "C:\Users\MHD\Anaconda3\envs\tf15\lib\site-packages\tensorflow\python\platform\app.py", line 124, in run _sys.exit(main(argv)) File "C:\Users\MHD\Anaconda3\envs\tf15\lib\site-packages\tensorflow\python\util\deprecation.py", line 136, in new_func return func(*args, **kwargs) File "train.py", line 175, in main graph_hook_fn=graph_rewriter_fn) File "C:\tensorflow1\models\research\object_detection\legacy\trainer.py", line 249, in train detection_model = create_model_fn() File "C:\tensorflow1\models\research\object_detection\builders\model_builder.py", line 119, in build return _build_ssd_model(model_config.ssd, is_training, add_summaries) File "C:\tensorflow1\models\research\object_detection\builders\model_builder.py", line 237, in _build_ssd_model is_training=is_training) File "C:\tensorflow1\models\research\object_detection\builders\model_builder.py", line 187, in _build_ssd_feature_extractor if feature_extractor_config.HasField('replace_preprocessor_with_placeholder'): ValueError: Protocol message SsdFeatureExtractor has no field replace_preprocessor_with_placeholder

请帮助我

1 个答案:

答案 0 :(得分:0)

找出此错误的原因,我发现最近添加了选项replace_preprocessor_with_placeholder。这是提交record.(在该页面上,如果您搜索replace_preprocessor_with_placeholder,则会发现它是在2019年3月7日添加的。)

因此,错误的原因显然是您的原始文件版本与代码版本不一致。如果在本地计算机和github存储库上比较object_detection/protos/ssd.proto,您可能会发现line在本地计算机的文件中不存在(因为该文件也是最近添加的!)。

解决此错误的最简单方法是按照此guide重新安装对象检测API

由于您已经安装了所有软件包,因此基本上需要执行两个步骤,即安装coco api并编译原型。一个新的probbuff编译将修复您的错误。

我也建议您遵循最新的api教程,在您的通话中看到您正在使用train.py,该文件现已放置在旧版文件夹中,不建议运行,因为它们可能无法正常运行-迄今为止。