python - 如何修复 'tuple' 对象没有属性 'layer' ?

标签 python tensorflow keras deep-learning efficientnet

我正在使用 effectivenet 中的层对该层进行一些后处理,但在提取该层并对其执行操作后,它显示:

AttributeError: 'tuple' object has no attribute 'layer' .

python 3.6.2 上运行,使用 tensorflow 2.0keras 2.2.4。尝试过像 ResNet 这样的 keras 模型,效果很好。

base_model = EfficientNetB4((img_height, img_width, 3), weights='imagenet', include_top=False)
base_model.summary()    
x = base_model.get_layer('swish_96').output
x_a = ASPP(x)

ASPP(atrous Spatial Pyramid Pooling)是在获取图层后对x执行各种图层操作的类。

最佳答案

tensorflow和keras版本冲突。通过将其更改为 tf 1.14 解决。

关于python - 如何修复 'tuple' 对象没有属性 'layer' ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57004743/

相关文章:

tensorflow - 图像增强使性能变差

python - NumPy 不会在 Win7 的 Python 3.4.0 中安装

python - Dataframe 行中的列合并和移动元素

python - 使用 mpldatacursor 时如何更改数据光标的内容

tensorflow - 如何将 TFRecord 示例从字节字符串解析为张量字典?

python - L1-L2 正则化的不同系数

python - python 中的正则表达式 : removing square brackets and parts of the phrase inside of the brackets

tensorflow - TypeError : Inputs to a layer should be tensors. 得到:<PrefetchDataset 形状:

python - Tensorflow 服务响应

python - 层顺序的输入与层 : shapes error in LSTM 不兼容