I was trying to build a simple sequential model processing dataset with 480*640 RGB images.
model.add(Convolution2D(64, 3, 3, border_mode="same", input_shape=(3, 480, 640), init="glorot_uniform"))
However, the exception throws as
Exception: Input 0 is incompatible with layer dense_1: expected ndim=2, found ndim=4
The shape of x_train is:
(200, 480, 640, 3)
200 is the number of samples, 480, 640 and 3 represent the 480*640 RGB value.
I am confused and look forward to have an answer.
Please read the docs first. Dense layer requires a 2d input.
model.add(Convolution2D(...)) # Output shape of convolution is 4d
model.add(Flatten()) # Flatten input into 2d
model.add(Dense(...)) # Dense layer require a 2d input
Most helpful comment
Please read the docs first. Dense layer requires a 2d input.