Skip to content

AttributeError: 'module' object has no attribute 'keras' #6552

@nezygis

Description

@nezygis

System information

  • What is the top-level directory of the model you are using: object_detection
  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): no
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 16.04
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version (use command below): 1.13
  • Bazel version (if compiling from source): N/A
  • CUDA/cuDNN version:
  • GPU model and memory:
  • Exact command to reproduce:
    gcloud ml-engine jobs submit training whoamiobject_detectiondate +%s --job-dir=${YOUR_GCS_BUCKET}/train --packages dist/object_detection-0.1.tar.gz,slim/dist/slim-0.1.tar.gz --module-name object_detection.train --region europe-west1

Describe the problem

I tried to run object detection workflow on gcloud ml-engine by following this guide: https://cloud.google.com/blog/products/gcp/training-an-object-detector-using-cloud-machine-learning-engine

Initially the job would fail with no module named object_detection.train so I followed advice I found on stackoverflow and copied models\research\object_detection\legacy\train.py to models\research\object_detection and reran python setup.py sdist. After that I tried to run the job again with the command I listed above and it failed with AttributeError: 'module' object has no attribute 'keras'

Source code / logs

Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 162, 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 51, in <module> from object_detection.builders import model_builder File "/root/.local/lib/python2.7/site-packages/object_detection/builders/model_builder.py", line 22, in <module> from object_detection.builders import box_predictor_builder File "/root/.local/lib/python2.7/site-packages/object_detection/builders/box_predictor_builder.py", line 20, in <module> from object_detection.predictors import convolutional_box_predictor File "/root/.local/lib/python2.7/site-packages/object_detection/predictors/convolutional_box_predictor.py", line 19, in <module> from object_detection.core import box_predictor File "/root/.local/lib/python2.7/site-packages/object_detection/core/box_predictor.py", line 137, in <module> class KerasBoxPredictor(tf.keras.Model): AttributeError: 'module' object has no attribute 'keras'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions