Google ML Engine preprocessor_pb2 ImportError

我试图通过Google的ML Engine进行训练。

我主要按照以下文章中的步骤来开发我的训练和测试集:https://towardsdatascience.com/build-a-taylor-swift-detector-with-the-tensorflow-object-detection-api-ml-engine-and-swift-82707f5b4a56

我反复遇到以下错误:

Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/root/.local/lib/python2.7/site-packages/object_detection/train.py", line 49, in <module> from object_detection import trainer File "/root/.local/lib/python2.7/site-packages/object_detection/trainer.py", line 27, in <module> from object_detection.builders import preprocessor_builder File "/root/.local/lib/python2.7/site-packages/object_detection/builders/preprocessor_builder.py", line 21, in <module> from object_detection.protos import preprocessor_pb2 ImportError: cannot import name preprocessor_pb2

我克隆并按照object_detection的安装步骤进行操作,包括protobuf编译和设置PYTHONPATH!从控制台运行的示例model_builder_test.py也正常运行。

我的训练作业如下:

gcloud ml-engine jobs submit training my_training_job \--job-dir=gs://myapp.appspot.com/train \--packages dist/object_detection-0.1.tar.gz,slim/dist/slim-0.1.tar.gz \--module-name object_detection.train \--region us-central1 \--config object_detection/samples/cloud/cloud.yml \-- \--train_dir=gs://myapp.appspot.com/train \--pipeline_config_path=gs://myapp.appspot.com/data/ssd_mobilenet_v1_coco.config

在控制台中运行python -v返回的版本是2.7


回答:

我想我通过将运行时版本降低到1.2来解决了这个问题:

gcloud ml-engine jobs submit training my_training_job \--runtime-version 1.2 \--job-dir=gs://myapp.appspot.com/train \--packages dist/object_detection-0.1.tar.gz,slim/dist/slim-0.1.tar.gz \--module-name object_detection.train \--region us-central1 \--config object_detection/samples/cloud/cloud.yml \-- \-- train_dir=gs://myapp.appspot.com/train \-- pipeline_config_path=gs://myapp.appspot.com/data/ssd_mobilenet_v1_coco.config

随后我收到了关于缺少matplotlib的错误,并更改了以下行:

models/research/setup.pyREQUIRED_PACKAGES = ['Pillow>=1.0', 'matplotlib']

并重新运行:

python setup.py sdist(cd slim && python setup.py sdist)

我迫不及待地希望Google能发布更多工具来简化训练工作流程!

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注