【问题标题】:AttributeError: module 'tensorflow' has no attribute 'get_default_graph' in anacondaAttributeError:模块'tensorflow'在anaconda中没有属性'get_default_graph'
【发布时间】:2021-06-08 04:20:29
【问题描述】:

我在这里遇到错误:

from keras.applications import VGG16

modelvgg =VGG16(include_top=True,weights=None)
modelvgg.load_weights("Data/vgg16_weights_tf_dim_ordering_tf_kernels.h5")
modelvgg.summary()
AttributeError: module 'tensorflow' has no attribute 'get_default_graph'

【问题讨论】:

    标签: tensorflow keras graph anaconda


    【解决方案1】:

    在您的导入中应该是:

    from tensorflow.keras.applications.vgg16 import VGG16

    查看文档here 并记住在导入的开头添加“tensorflow”。

    【讨论】:

      猜你喜欢
      • 2019-08-09
      • 2020-12-06
      • 1970-01-01
      • 2019-08-25
      • 1970-01-01
      • 1970-01-01
      • 2019-12-17
      • 2020-08-17
      相关资源
      最近更新 更多