简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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