'module' object has no attribute 'keras'问题解决方法

-多次安装tensorflow时出现同一,加以记录备忘,并希望帮到同样在奋斗的你。

安装tensorflow并进行如下测试:
 

python object_detection/builders/model_builder_test.py

出现如下问题:

Traceback (most recent call last):
  File "object_detection/builders/model_builder_test.py", line 23, in 
    from object_detection.builders import model_builder
  File "/home/farzad/Desktop/jrnl/face recognition/tensorflow/models/research/object_detection/builders/model_builder.py", line 22, in 
    from object_detection.builders import box_predictor_builder
  File "/home/farzad/Desktop/jrnl/face recognition/tensorflow/models/research/object_detection/builders/box_predictor_builder.py", line 21, in 
    from object_detection.predictors import convolutional_box_predictor
  File "/home/farzad/Desktop/jrnl/face recognition/tensorflow/models/research/object_detection/predictors/convolutional_box_predictor.py", line 19, in 
    from object_detection.core import box_predictor
  File "/home/farzad/Desktop/jrnl/face recognition/tensorflow/models/research/object_detection/core/box_predictor.py", line 137, in 
    class KerasBoxPredictor(tf.keras.Model):
AttributeError: 'module' object has no attribute 'keras'

可能是由于tensorflow版本问题导致的,需要升级tensorflow

pip install -U tensorflow

即可解决问题!

成功进入下一个问题的解决阶段!开心(并不

 

 

参考:https://github.com/tensorflow/models/issues/5590

你可能感兴趣的:(视觉识别,解决错误)