network is as follows:
-sharp1st layer
model.add(Conv2D(20, 5, 5, activation="sigmoid", input_shape=(32, 32, 1)))
model.add(MaxPool2D(pool_size=(2, 2)))
-sharp2nd layer
model.add(Conv2D(30, 5, 5, activation="sigmoid"))
model.add(MaxPool2D(pool_size=(2, 2)))
-sharpfully connected layer
model.add(Flatten())
model.add(Dense(500, init="normal", activation="sigmoid"))
-sharp model.add(Dropout(0.5))
-sharp model.add(Dense(10, activation="sigmoid"))
-sharpmodel.add(Reshape((-1, 5)))
model.add(Dense(5, init="normal", activation="softmax"))
when calling the network:
model.fit(x=traindata, y=trainlabel, batch_size=16, nb_epoch=15, shuffle=True, verbose=1, validation_data=(testdata, testlabel))
this is the error report:
ValueError: Error when checking input: expected conv2d_1_input to have 4 dimensions, but got array with shape (500,5)
then the x vector is 4-dimensional picture information, and the y vector is the label of the picture. Their shape is (500,32,32,1), (500,5), respectively. I just don"t understand why the y direction also needs to be 4-dimensional
.