I am working on a CNN model for multi-class image classification, while both loss and accuracy show flatline and values stay almost same. Could you please help have a look if any mistakes made and much appreciate if any advice? thanks a lot in advance.
Loss and accuracy:
Input data
(X_train.shape, X_test.shape, y_train.shape, y_test.shape) (24296, 32, 32, 1) (6075, 32, 32, 1) (24296, 6) (6075, 6)
X_train:
y_train:
CNN code
model
model = Sequential()
model.add(Conv2D(16, (2,2), activation = 'relu', input_shape = (32,32,1)))
model.add(MaxPooling2D((2,2)))
model.add(Conv2D(32, (2,2), activation = 'relu'))
model.add(MaxPooling2D((2,2)))
model.add(Conv2D(64, (2,2), activation = 'relu'))
model.add(MaxPooling2D((2,2)))
model.add(Conv2D(128, (2,2), activation = 'relu'))
model.add(MaxPooling2D((2,2)))
model.add(Flatten())
model.add(Dense(100, activation = 'relu'))
model.add(Dense(6, activation = 'softmax'))
compile
model.compile(loss = 'categorical_crossentropy',
optimizer = optimizers.RMSprop(learning_rate=0.001),
metrics = ['accuracy'])
early stopping and fit
es = EarlyStopping(patience = 5, verbose=2)
history = model.fit(X_train, y_train,
validation_split = 0.2,
callbacks=[es],
epochs=100,
batch_size=64)
I checked the community, tried different optimizer (adam, sgd and RMSprop), parameters like learning rate and also different layers, but similar result.I expect the loss drop and accuracy increase, no flatline.