6
$\begingroup$

I am using convolutional neural networks (via Keras) as my model for facial expression recognition (55 subjects). My data set is quite hard and around 450k with 7 classes. I have balanced my training set per subject and per class label.

I implemented a very simple CNN architecture (with real-time data augmentation):

model = Sequential()
model.add(Convolution2D(32, 3, 3, border_mode=borderMode, init=initialization,  input_shape=(48, 48, 3)))
model.add(BatchNormalization())
model.add(PReLU())
model.add(MaxPooling2D(pool_size=(2, 2)))

model.add(Flatten())
model.add(Dense(256))
model.add(BatchNormalization())
model.add(PReLU())
model.add(Dropout(0.5))

model.add(Dense(nb_output))
model.add(Activation('softmax'))

After first epoch, my training loss decreases constantly while validation loss increases. Could overfitting happen that soon? Or is there a problem with my data being confusing? Should I also balance my testing set?

$\endgroup$

2 Answers 2

5
$\begingroup$

It is very unlikely for such huge dataset(450k ) to overfit after just one epoch.

Try to run the code for 20-30 epochs and see if you see any decrease in the validation set error (increase in validation accuracy.)

Try to change your learning rate if (unless you are using adaptive learning parameter)

$\endgroup$
1
  • 1
    $\begingroup$ increasing the learning rate solved it in my particular problem! Thanks for the hint! $\endgroup$
    – MJimitater
    Commented Apr 7, 2021 at 12:35
3
$\begingroup$

Balancing the training set makes sense, there is no need to balance the test set. Anyway, you should not be watching overfitting in such a simple model.

It is interesting to validate that the training set and validation set variables are exactly the same, and if you did not do any transformation in a set and for some reason did not in the other.

I understand you are doing holdout crossvalidation, try k-fold crossvalidation or bootstrap can help.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.