简体   繁体   中英

Error on gcloud with tensorflow.python.keras.applications for machine learning

Im working with gcloud and I got this error:

The replica master 0 exited with a non-zero status of 1. 
Traceback (most recent call last):
  File "/opt/conda/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/opt/conda/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/root/.local/lib/python3.7/site-packages/object_detection/model_main.py", line 25, in <module>
    from object_detection import model_lib
  File "/root/.local/lib/python3.7/site-packages/object_detection/model_lib.py", line 30, in <module>
    from object_detection import exporter as exporter_lib
  File "/root/.local/lib/python3.7/site-packages/object_detection/exporter.py", line 24, in <module>
    from object_detection.builders import model_builder
  File "/root/.local/lib/python3.7/site-packages/object_detection/builders/model_builder.py", line 37, in <module>
    from object_detection.meta_architectures import deepmac_meta_arch
  File "/root/.local/lib/python3.7/site-packages/object_detection/meta_architectures/deepmac_meta_arch.py", line 19, in <module>
    from object_detection.models.keras_models import resnet_v1
  File "/root/.local/lib/python3.7/site-packages/object_detection/models/keras_models/resnet_v1.py", line 22, in <module>
    from tensorflow.python.keras.applications import resnet
ModuleNotFoundError: No module named 'tensorflow.python.keras.applications'

My requeriments.txt file is:

six
google-api-python-client>=1.6.7
kaggle>=1.3.9
Keras-Applications
numpy>=1.15.4
oauth2client
pandas>=0.22.0
psutil>=5.4.3
py-cpuinfo>=3.3.0
scipy>=0.19.1
tensorflow-hub>=0.6.0
tensorflow-model-optimization
tensorflow-model-optimization>=0.4.1
tensorflow-addons
dataclasses;python_version<"3.7"
gin-config
tf_slim>=1.1.0
Cython
matplotlib
# Loader becomes a required positional argument in 6.0 in yaml.load
pyyaml>=5.1,<6.0
# CV related dependencies
opencv-python-headless
Pillow
pycocotools
# NLP related dependencies
seqeval
sentencepiece
sacrebleu

From my terminal I used this code to run the machine learning:

gcloud ai-platform jobs submit training segmentation_maskrcnn_img_53 ^
    --runtime-version 2.5 ^
    --python-version 3.7 ^
    --job-dir=gs://meat-segmentation-img/training_process ^
    --package-path ./object_detection ^
    --module-name object_detection.model_main ^
    --region us-central1 ^
    --scale-tier CUSTOM ^
    --master-machine-type n1-standard-16 ^
    --master-accelerator count=1,type=nvidia-tesla-t4 ^
    -- ^
    --model_dir=gs://meat-segmentation-img/training_process ^
    --pipeline_config_path=gs://meat-segmentation-img/mask_rcnn_inception_resnet_v2_1024x1024_coco17_gpu-8.config

I used runtime version 2.7 but I got this error:

ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /opt/conda/lib/python3.7/site-packages/scipy/optimize/_group_columns.cpython-37m-x86_64-linux-gnu.so)

How I fix this?

I'm using this from Windows by conda environment.

You may need to modify the code for importing keras applications as

from tensorflow.keras import applications

in place of

from tensorflow.python.keras import applications .

Please check this link for more details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM