python - Google ML Engine preprocessor_pb2 ImportError

标签 python tensorflow machine-learning google-cloud-ml

我正在尝试通过 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.py

REQUIRED_PACKAGES = ['Pillow>=1.0', 'matplotlib']

并重新运行:

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

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

关于python - Google ML Engine preprocessor_pb2 ImportError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49965161/

相关文章:

python - Dask 诊断 - 带 map_partition/delayed 的进度条

python - 获取 OSError : [Errno 16] Device or resource busy: ' when using tf. keras.models.Sequential.fit_generator

python - pytorch 中轴与数组不匹配错误

python - 如何对 3D 卷积数组执行最大池化操作?

machine-learning - Keras 如何反向传播自定义损失函数?

machine-learning - 随机决策树分类

javascript - 向 websocket 客户端发送消息时压缩位必须为 0

python - 如何使用 django-celery 配置 TASK_SERIALIZER

Python Pandas : Get dataframe. value_counts() 结果作为列表

python - sess.run() 多个操作 vs 多个 sess.run()