在用keras建立cnn模型时一直报错如下
ValueError: The shape of the input to "Flatten" is not fully defined (got (0, 6, 80). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.
代码如下:
model = models.Sequential()
model.add(Reshape([1]+in_shp, input_shape=in_shp))
model.add(Convolution2D(256, 1, 3, border_mode='valid', activation="relu", name="conv1", init='glorot_uniform'))
model.add(Flatten())
解决方法:提示ake sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model。所以把model.add(Reshape([1]+in_shp, input_shape=in_shp))改为model.add(Reshape((1,2,128)),直接添加你要输入的维度,输出维度(none,1,2,128).问题解决