Tensorflow 错误:协议消息 ConvolutionalBoxPredictor 没有字段 box_encodings_clip_range

Tensorflow 错误:协议消息 ConvolutionalBoxPredictor 没有字段 box_encodings_clip_range

我是 Tensorflow 新手,正在尝试简单教程用于进行迁移学习。

当我尝试通过以下命令启动训练时:

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

我收到以下错误:

WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
  * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
  * https://github.com/tensorflow/addons
If you depend on functionality not listed there, please file an issue.

WARNING:tensorflow:From /home/USER/.local/lib/python3.6/site-packages/tensorflow/python/platform/app.py:125: 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 184, in <module>
    tf.app.run()
  File "/home/USER/.local/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run
    _sys.exit(main(argv))
  File "/home/USER/.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 324, in new_func
    return func(*args, **kwargs)
  File "train.py", line 180, in main
    graph_hook_fn=graph_rewriter_fn)
  File "/home/USER/AI_Workspace/models/research/object_detection/legacy/trainer.py", line 249, in train
    detection_model = create_model_fn()
  File "/home/USER/AI_Workspace/models/research/object_detection/builders/model_builder.py", line 132, in build
    return _build_ssd_model(model_config.ssd, is_training, add_summaries)
  File "/home/USER/AI_Workspace/models/research/object_detection/builders/model_builder.py", line 279, in _build_ssd_model
    num_classes, ssd_config.add_background_class)
  File "/home/USER/AI_Workspace/models/research/object_detection/builders/box_predictor_builder.py", line 690, in build
    if config_box_predictor.HasField('box_encodings_clip_range'):
ValueError: Protocol message ConvolutionalBoxPredictor has no field box_encodings_clip_range.

我不知道这是什么意思。有人知道这是什么以及是什么原因造成的吗?

答案1

检查安装指南:https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md

您可能没有运行 protoc。

如果你使用的是 Linux:

下载并安装 protoc 3.0 版本,然后解压文件。

# From tensorflow/models/research/
wget -O protobuf.zip https://github.com/google/protobuf/releases/download/v3.0.0/protoc-3.0.0-linux-x86_64.zip
unzip protobuf.zip

再次运行编译过程,但使用下载的 protoc 版本

 # From tensorflow/models/research/
 ./bin/protoc object_detection/protos/*.proto --python_out=.

相关内容