ValueError: Error when checking target: expected dense_2 to have 4 dimensions, but got array with shape (7942, 1)

帅比萌擦擦* 提交于 2019-12-06 05:42:26

The message says that y_train is not compatible with the model's output.

Your model is outputting (None, width, height, 1). You should add a Flatten() layer after the convolution to make the data have only 2 dimensions from this point on.


Additional comments:

The input data must have a shape compatible with the model.

The shape of X_train must be (7942,80,80,1)
The input_shape of the model must be (80,80,1)

If you use a (1,6400, 1) shape, your Conv2D layer will be pretty useless, because it will not be able to intepret the data as a 2D image.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!