Keras报错:ValueError: Input 0 of layer sequential is incompatible with the layer

运行书上代码

(X_train, y_train), (X_validation, y_validation) = mnist.load_data()

X_train = X_train.reshape(X_train.shape[0], 1,28, 28).astype('float32')
X_validation = X_validation.reshape(X_validation.shape[0],1, 28, 28).astype('float32')


X_train = X_train / 255
X_validation = X_validation / 255


y_train = np_utils.to_categorical(y_train)
y_validation = np_utils.to_categorical(y_validation)


def create_model():
    model = Sequential()
    model.add(Conv2D(32, (5, 5), input_shape=(28,28,1), activation='relu'))
    model.add(MaxPooling2D(pool_size=(2, 2)))
    model.add(Dropout(0.2))
    model.add(Flatten())
    model.add(Dense(units=128, activation='relu'))
    model.add(Dense(units=10, activation='softmax'))

    model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
    return model

model = create_model()
model.fit(X_train, y_train, epochs=10, batch_size=200, verbose=2)

时有如下报错:

ValueError: Input 0 of layer sequential is incompatible with the layer: expected axis -1 of input shape to have value 1 but received input with shape (None, 1, 28, 28)

找了很多方法都没能解决,实在不懂,求解答

Input 0 of layer sequential is incompatible with the layer: expected axis -1 of input shape to have value 3 but received input with shape (32, 64, 64, 1),碰到了类似的,请问你解决了吗?