'ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 32, 32, 1), found shape=(None, 1, 32, 32, 3, 1, 1)
I'm trying to train the model I created:
model = Sequential()
model.add(Conv2D(8, (5, 5), activation="relu", input_shape=(32, 32, 1)))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Conv2D(filters=16, kernel_size=(3, 3), strides=(2, 2), activation="relu"))
model.add(AveragePooling2D(pool_size=(2, 2)))
model.add(Flatten())
model.add(Dense(8, activation='tanh'))
model.add(Dense(n_classes, activation='softmax'))
and this is my code (it was provided, I just had to insert things such as batch_size, epochs etc):
model.compile(optimizer = tf.keras.optimizers.RMSprop(learning_rate=0.003),
loss='categorical_crossentropy',
metrics=['accuracy'])
model.summary()
#Train
batch_size = 128
epochs = 500
model.fit(x_train,
y_train,
batch_size=batch_size,
epochs=10,
validation_split=0.2)
# Evaluate model
scores = model.evaluate(x_test, y_test)
print('Test loss: {} - Accuracy: {}'.format(*scores))
And I've been getting this very long error. Since I'm new to python, I can't get what it means:
I can't post the whole pic since i'm new to Stack, but here it goes
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
