简体   繁体   English

如何提高图像分类模型的模型精度

[英]how to increase model accuracy in image classification model

I am doing image classification, I got train accuracy is 90 and validation is 85, please help me how to improve accuracy.This my model. 我正在做图像分类,我的火车精度是90,验证是85,请帮助我如何提高精度。这是我的模型。

model = Models.Sequential()

model.add(Layers.Conv2D(200,kernel_size=(3,3),activation='relu',input_shape=(64,64,3)))
model.add(Layers.Conv2D(180,kernel_size=(3,3),activation='relu'))
model.add(Layers.MaxPool2D(2,2))
model.add(Layers.Conv2D(180,kernel_size=(3,3),activation='relu'))
model.add(Layers.Conv2D(140,kernel_size=(3,3),activation='relu'))
model.add(Layers.Conv2D(100,kernel_size=(3,3),activation='relu'))
model.add(Layers.Conv2D(50,kernel_size=(3,3),activation='relu'))
model.add(Layers.MaxPool2D(2,2))
model.add(Layers.Flatten())
model.add(Layers.Dense(180,activation='relu'))
model.add(Layers.Dropout(rate=0.5))
model.add(Layers.Dense(100,activation='relu'))
model.add(Layers.Dropout(rate=0.5))
model.add(Layers.Dense(50,activation='relu'))
model.add(Layers.Dropout(rate=0.5))
model.add(Layers.Dense(6,activation='softmax'))

model.compile(optimizer=Optimizer.Adam(lr=0.0001),loss='sparse_categorical_crossentropy',metrics=['accuracy'])
SVG(model_to_dot(model).create(prog='dot', format='svg'))
Utils.plot_model(model,to_file='model.png',show_shapes=True)
model.summary()

this is my epochs: 这是我的时代:

Epoch 28/35
11923/11923 [==============================] - 58s 5ms/sample - loss: 0.3929 - acc: 0.8777 - val_loss: 0.4905 - val_acc: 0.8437
Epoch 29/35
11923/11923 [==============================] - 59s 5ms/sample - loss: 0.3621 - acc: 0.8849 - val_loss: 0.5938 - val_acc: 0.8394
Epoch 30/35
11923/11923 [==============================] - 58s 5ms/sample - loss: 0.3541 - acc: 0.8865 - val_loss: 0.4860 - val_acc: 0.8570
Epoch 31/35
11923/11923 [==============================] - 58s 5ms/sample - loss: 0.3460 - acc: 0.8909 - val_loss: 0.5066 - val_acc: 0.8450
Epoch 32/35
11923/11923 [==============================] - 58s 5ms/sample - loss: 0.3151 - acc: 0.9001 - val_loss: 0.5091 - val_acc: 0.8517
Epoch 33/35
11923/11923 [==============================] - 58s 5ms/sample - loss: 0.3184 - acc: 0.9025 - val_loss: 0.5097 - val_acc: 0.8431
Epoch 34/35
11923/11923 [==============================] - 58s 5ms/sample - loss: 0.3049 - acc: 0.9015 - val_loss: 0.5694 - val_acc: 0.8491
Epoch 35/35
11923/11923 [==============================] - 58s 5ms/sample - loss: 0.2896 - acc: 0.9085 - val_loss: 0.5293 - val_acc: 0.8464

please help me on how to reduce the error rate. 请帮助我减少错误率。

There isn't a unique answer. 没有唯一的答案。 You should test and discover what works for your problem. 您应该测试并发现什么对您的问题有效。

Some things you could try: 您可以尝试一些操作:

  • Increase the Dropout 增加辍学
  • Change your net architecture: Remove layers, add more layers 更改网络体系结构:删除层,添加更多层
  • Modify training parameters: Test other optimizers, a different number of epochs and learning rate 修改训练参数:测试其他优化器,不同的时期和学习率
  • Work with your training set: Sometimes the problem is in your data, analyze your data distribution, make sure that your training set provides a good representation of your classes and is well-balanced. 使用您的训练集:有时问题出在您的数据中,分析数据分布,确保您的训练集可以很好地代表您的课程并保持均衡。 Depending on your problem, you can test data augmentation techniques too. 根据您的问题,您也可以测试数据增强技术。

How I said, there is not a unique answer, you have to find out what works for your case. 我怎么说,这不是一个唯一的答案,您必须找出最适合自己的情况。 Deal with deep learning is to be constantly doing experiments to reach the best model to solve a problem. 应对深度学习是要不断地进行实验,以找到解决问题的最佳模型。

Try several models with different architectures/hyperparameters and see, which one performs the best. 尝试几种具有不同架构/超参数的模型,然后看看哪种模型效果最好。

For example, here is a paper on the subject . 例如,这是有关该主题论文 The authors use an evolutionary meta-heuristic to build the best architecture. 作者使用进化的元启发式方法来构建最佳架构。

In competitions, a useful technique is training an ensemble of models and averaging over their predictions. 在比赛中,一种有用的技术是训练一组模型并对其预测取平均值。

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

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