Keras顺序模型中要使用的时期数 [英] Number of epochs to be used in a Keras sequential model

查看:82
本文介绍了Keras顺序模型中要使用的时期数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建Keras顺序模型以进行二进制图像分类.现在,当我使用70到80个纪元时,我开始获得良好的验证准确性(81%).但有人告诉我,这是一个很大的数目,可能会影响网络的性能.

I'm building a Keras sequential model to do a binary image classification. Now when I use like 70 to 80 epochs I start getting good validation accuracy (81%). But I was told that this is a very big number to be used for epochs which would affect the performance of the network.

我的问题是:是否有数量不应该超过的时期,请注意,我有2000个训练图像和800个验证图像.

My question is: is there a limited number of epochs that I shouldn't exceed, note that I have 2000 training images and 800 validation images.

推荐答案

如果纪元数非常多,则您的模型可能会过拟合,并且您的训练准确性将达到100%.在这种方法中,您将错误率绘制在训练和验证数据上.横轴是历元数,纵轴是错误率.当验证数据的错误率最小时,您应该停止训练.

If the number of epochs are very high, your model may overfit and your training accuracy will reach 100%. In that approach you plot the error rate on training and validation data. The horizontal axis is the number of epochs and the vertical axis is the error rate. You should stop training when the error rate of validation data is minimum.

您需要在正则化参数之间进行权衡.深度学习的主要问题是过拟合模型.使用各种正则化技术,例如

You need to have a trade-off between your regularization parameters. Major problem in Deep Learning is overfitting model. Various regularization techniques are used,as

i)减小批量大小

ii)数据扩充(仅当您的数据不多样化时)

ii) Data Augmentation(only if your data is not diverse)

iii)批量归一化

iv)降低架构(主要是卷积层)的复杂性

iv) Reducing complexity in architecture(mainly convolutional layers)

v)引入辍学层(仅当您使用任何密集层时)

v) Introducing dropout layer(only if you are using any dense layer)

vi)学习率降低.

vii)转移学习

批处理大小与时代的权衡非常重要.此外,它取决于您的数据,并且因应用程序而异.在这种情况下,您必须稍微弄点数据才能知道确切的数字.通常,批处理大小为32个中等大小的图像需要10个历元才能从卷积层中提取出良好的特征.同样,它是相对的

Batch-size vs epoch tradeoff is quite important. Also it is dependent on your data and varies from application to application. In that case, you have to play with your data a little bit to know the exact figure. Normally a batch size of 32 medium size images requires 10 epochs for good feature extraction from the convolutional layers. Again, it is relative

这篇关于Keras顺序模型中要使用的时期数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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