Error:The shape of the input to Flatten is not fully defined got None, None, 120 .

115 阅读1分钟

 报错:

错误位置:

Flatten()

错误原因:

没有明确的规定输入的shape

解决方法:

输入模型时明确尺寸

e.g.   vgg16 = keras.applications.vgg16.VGG16(include_top=False, weights='imagenet', input_shape=(224, 224, 3))
x = vgg16.output
x = Flatten()(x)