我正在尝试通过 Google 的 ML 引擎进行培训。
我主要按照以下文章中的步骤来开发我的训练和测试集: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 发布更多工具来简化培训工作流程!
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句