我正在尝试运行这里看到的宠物探测器google cloud示例:https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/running_pets.md,并且在我实际尝试运行训练之前得到大部分路径,直到我运行命令:
gcloud ml-engine jobs submit training `whoami`_object_detection_`date +%s` \
--runtime-version 1.2 \
--job-dir=gs://test-run-2/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://test-run-2/train \
--pipeline_config_path=gs://test-run-2/data/pipeline.config
这不可避免地导致错误:
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
File "/root/.local/lib/python2.7/site-packages/object_detection/protos/preprocessor_pb2.py", line 71, in <module>
options=None, file=DESCRIPTOR),
TypeError: __new__() got an unexpected keyword argument 'file'
我不确定我在这里做错了什么或错误来自哪里,因为我在preprocessor_pb2.py文件中看不到。任何帮助将不胜感激!
答案 0 :(得分:1)
进入这个问题 - 可能是因为在尝试在1.2上运行作业时使用更新的tensorflow dist(1.4)。我通过传入一个设置它的yaml配置文件来解决它:
trainingInput:
runtimeVersion: "1.4"
pythonVersion: "3.5"
如果遇到matplot lib导入错误,您需要立即关注:https://github.com/tensorflow/models/issues/2739#issuecomment-351213863,直到tensorflow模型repo修复它。
答案 1 :(得分:0)
在将tensorflow升级到1.11版并运行后解决了此问题:
pip install --upgrade protobuf
答案 2 :(得分:-1)
@olive_tree有一个很好的答案,最终成为我的问题的是我正在编译的protobuf的版本。确保protoc版本与此处描述的正确版本匹配:https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md
这是我最终必须运行(在OSX上)
brew uninstall protobuf
brew install protobuf@2.6
瞧,问题解决了!