小编Bhu*_*n S的帖子

Keras AttributeError:“功能”对象没有属性“形状”

尝试将 Densenet121 功能块添加到模型中。我需要以这种格式编写 Keras 模型,而不是使用

model=Sequential() 
model.add()
Run Code Online (Sandbox Code Playgroud)

方法 build_img_encod 函数出了什么问题

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-62-69dd207148e0> in <module>()
----> 1 x = build_img_encod()

3 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/input_spec.py in assert_input_compatibility(input_spec, inputs, layer_name)
    164         spec.min_ndim is not None or
    165         spec.max_ndim is not None):
--> 166       if x.shape.ndims is None:
    167         raise ValueError('Input ' + str(input_index) + ' of layer ' +
    168                          layer_name + ' is incompatible with the layer: '

AttributeError: 'Functional' object has no attribute 'shape'
Run Code Online (Sandbox Code Playgroud)
def build_img_encod( …
Run Code Online (Sandbox Code Playgroud)

deep-learning keras tensorflow transfer-learning

5
推荐指数
1
解决办法
1万
查看次数