shape error while using cnn model for image classification

Viewed 30

Shapes (None, 1) and (None, 10) are incompatible is my error message

cnn = models.Sequential([
    layers.Conv2D(filters=32, kernel_size=(3, 3), activation='relu', input_shape=(224, 224, 3)),
    layers.MaxPooling2D((2, 2)),
    
    layers.Conv2D(filters=64, kernel_size=(3, 3), activation='relu'),
    layers.MaxPooling2D((2, 2)),
    
    layers.Flatten(),
    layers.Dense(64, activation='relu'),
    layers.Dense(10, activation='softmax')
])

is the model i am using ,my x train and ytrain have 1000 samples and shape of x train is 224, 224,3 y train is an array with outputs as numbers 0,1,2, for classification how do i fix this shape error?

0 Answers
Related