简体   繁体   English

关于使用 CNN 进行图像分类

[英]Regarding image classification using CNN

I built a image classification model using convolutional neural network for 5 classes.It is giving the training accuracy as 100% and testing accuracy as 82%.我使用卷积神经网络为 5 个类别建立了一个图像分类模型,训练准确率为 100%,测试准确率为 82%。 But when I gave an image manually for predicting, the model is not able to classify them correctly.For 10 images the model is classifying only 3-4 images correctly.What is the mistake?但是当我手动给一个图像进行预测时,模型无法正确分类它们。对于 10 张图像,模型只能正确分类 3-4 张图像。错误是什么? What should I do??我该怎么办??

It is the symptoms of overfitting. 这是过度拟合的症状。 You can try tweaking the model's parameters and number of layers. 您可以尝试调整模型的参数和层数。 Please also try using Dropouts. 也请尝试使用辍学。 If using Tensorflow, learn more tensorflow documentation 如果使用Tensorflow,请了解更多Tensorflow文档

This means that you are clearly overfitting. 这意味着您显然过拟合了。 Your model is not able to generalize well to the images that you enter manually. 您的模型不能很好地推广到您手动输入的图像。 There are a few things that you could do. 您可以做一些事情。

  1. You could try regularization so that your model does not overfit. 您可以尝试进行正则化,以便模型不会过拟合。
  2. Try getting more data 尝试获取更多数据
  3. Data augmentation 资料扩充

I hope that by introducing regularization, your model would work better on manually entered images. 我希望通过引入正则化,您的模型可以在手动输入的图像上更好地工作。

Your model is not able to generalize properly. 您的模型无法正确归纳。 the training has gone very quickly through all the images in the training set and even started making predictions on the same images. 训练非常快地遍历了训练集中的所有图像,甚至开始对同一图像进行预测。

  1. Try adding images and of different sizes. 尝试添加不同大小的图像。

  2. Try flipping the original images horizontally to create transformed images that might also help in accurately training your model. 尝试水平翻转原始图像以创建变换后的图像,这也可能有助于准确地训练模型。

Besides that, probably your training set has way easier images than your test set (those image that you give manually).除此之外,您的训练集可能比您的测试集(您手动提供的那些图像)更容易获得图像。 That can happen even if you are feeding the network from the same dataset.即使您从同一数据集为网络提供数据,也可能发生这种情况。

To have better results on unseen images, you must have to reach a good generalisation level.要在看不见的图像上获得更好的结果,您必须达到良好的泛化水平。 Try what is said previously above...试试上面说的...

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

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