天天看点

成功解决AttributeError: module 'tensorflow.python.keras' has no attribute 'Model'

解决问题

 File "object_detection/builders/model_builder_test.py", line 24, in <module>

   from object_detection.builders import model_builder

 File "F:\File_Python\Python_example\models-master\research\object_detection\builders\model_builder.py", line 22, in <module>

   from object_detection.builders import box_predictor_builder

 File "F:\File_Python\Python_example\models-master\research\object_detection\builders\box_predictor_builder.py", line 21, in <module>

   from object_detection.predictors import convolutional_box_predictor

 File "F:\File_Python\Python_example\models-master\research\object_detection\predictors\convolutional_box_predictor.py", line 19, in <module>

   from object_detection.core import box_predictor

 File "F:\File_Python\Python_example\models-master\research\object_detection\core\box_predictor.py", line 137, in <module>

   class KerasBoxPredictor(tf.keras.Model):

AttributeError: module 'tensorflow.python.keras' has no attribute 'Model'

解决方法

升级tensorflow到最新版本即可!

pip install -U tensorflow

继续阅读