在第一个时期过拟合 [英] Overfitting after first epoch

本文介绍了在第一个时期过拟合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用卷积神经网络(通过Keras)作为面部表情识别的模型(55个主题).我的数据集非常艰苦,大约有7个类,大约450k.我已经平衡了每个科目和每个班级标签的训练集.

我实现了一个非常简单的CNN架构(具有实时数据增强功能):

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'))

在第一个时期之后,我的训练损失不断减少,而验证损失却增加了.过度拟合会很快发生吗?还是我的数据令人困惑?我还应该平衡测试集吗?

解决方案

任务可能很容易解决,并且在一个时期之后,该模型已经学会了足够的解决方案,而训练更多的时期只会增加过度拟合. /p>

但是,如果您平衡了训练集而不是测试集,那么可能正在发生的事情是,您正在训练一个任务(对均匀分布的数据的表情识别),然后在一个稍有不同的任务上进行测试,因为测试集不平衡.

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?

解决方案

It could be that the task is easy to solve and after one epoch the model has learned enough to solve it, and training for more epochs just increases overfitting.

But if you have balanced the train set and not the test set, what may be happening is that you are training for one task (expression recognition on evenly distributed data) and then you are testing on a slightly different task, because the test set is not balanced.

这篇关于在第一个时期过拟合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆