简体   繁体   English

如何在此类机器学习任务中修复 batch_size 和 epoch

[英]How fix batch_size and epoch in such machine learning task

I train a ResNet50 network.我训练了一个 ResNet50 网络。
I have a dataset with 1500 images, I fix epochs = 100 and batch_size = 16, I find that accuracy reaches 0.8 from the 10th epoch and continues to increase until 0.95.我有一个包含 1500 张图像的数据集,我修正了 epochs = 100 和 batch_size = 16,我发现从第 10 个 epoch 开始,准确率达到了 0.8,并继续增加到 0.95。 Now, I add images for this dataset, it becomes 15 000 and with epochs = 100 and batch_size = 16. I observed that accuracy does not exceed 0.6 .现在,我为这个数据集添加图像,它变成 15 000,epochs = 100 和 batch_size = 16。我观察到准确度不超过 0.6 。 I can't understand reasons?我无法理解原因?

The accuracy of a deep learning model mainly depends on the nature of the dataset and number of samples within the dataset.深度学习模型的准确性主要取决于数据集的性质和数据集中的样本数量。 The more samples, the more epochs you would need.样本越多,您需要的时期就越多。 However, batch size has greater effect on the speed of training a model rather than accuracy.然而,批量大小对模型训练速度的影响比准确性更大。

In your case, keeping epochs constant (100), it's understandable that dataset with 15000 samples will have less accuracy then a dataset with 1500 samples.在您的情况下,保持 epochs 恒定(100),可以理解的是,具有 15000 个样本的数据集的准确度会低于具有 1500 个样本的数据集。 If you want to achieve the desired accuracy on larger dataset, then you'd need to train your model for more epochs, let say try 200 and see the results.如果您想在更大的数据集上达到所需的准确度,那么您需要针对更多时期训练您的模型,比如尝试 200 次并查看结果。

Another thing you need to keep in mind that how you are calculating the accuracy?您需要记住的另一件事是您如何计算准确性? Is it training accuracy or accuracy calculated using unseen test set?是训练准确率还是使用看不见的测试集计算的准确率? It totally depends on the diversity of your dataset.这完全取决于数据集的多样性。

In short, for better training results, you need to make your dataset diverse with enough samples to get a generalized model.简而言之,为了获得更好的训练结果,您需要使用足够多的样本使您的数据集多样化,以获得通用模型。 For better accuracy results, you need to keep training your model for enough epochs unless you see improvements in the accuracy.为了获得更好的准确度结果,您需要持续训练模型足够多的 epoch,除非您看到准确度有所提高。 Hope these information help you !!!希望这些信息对你有帮助!!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM