简体   繁体   中英

validation accuracy is high during training each epoch in a CNN but final accuracy in classification report very low what does it mean?

I was building a CNN model for predicting the class of of an x-ray image as covid infected or not. during training the model this is what i was getting as accuracy and loss in each epoch.

Epoch 1/20
43/43 [==============================] - 157s 4s/step - loss: 16.5535 - accuracy: 0.8844 - val_loss: 1.6308 - val_accuracy: 0.9914

Epoch 2/20
43/43 [==============================] - 153s 4s/step - loss: 9.3576 - accuracy: 0.9647 - val_loss: 1.8470 - val_accuracy: 0.9871

Epoch 3/20
43/43 [==============================] - 152s 4s/step - loss: 4.8507 - accuracy: 0.9720 - val_loss: 2.1491 - val_accuracy: 0.9871

Epoch 4/20
43/43 [==============================] - 153s 4s/step - loss: 2.8917 - accuracy: 0.9772 - val_loss: 0.5409 - val_accuracy: 0.9914

Epoch 5/20
43/43 [==============================] - 153s 4s/step - loss: 1.7138 - accuracy: 0.9831 - val_loss: 0.4102 - val_accuracy: 0.9957

Epoch 6/20
43/43 [==============================] - 153s 4s/step - loss: 2.4398 - accuracy: 0.9801 - val_loss: 5.5315 - val_accuracy: 0.9569

Epoch 7/20
43/43 [==============================] - 153s 4s/step - loss: 4.3175 - accuracy: 0.9661 - val_loss: 0.5032 - val_accuracy: 0.9914

Epoch 8/20
43/43 [==============================] - 152s 4s/step - loss: 1.7567 - accuracy: 0.9816 - val_loss: 0.5169 - val_accuracy: 0.9914

Epoch 9/20
43/43 [==============================] - 153s 4s/step - loss: 1.5359 - accuracy: 0.9786 - val_loss: 0.2652 - val_accuracy: 0.9957

Epoch 10/20
43/43 [==============================] - 153s 4s/step - loss: 0.9022 - accuracy: 0.9897 - val_loss: 0.1173 - val_accuracy: 0.9957

Epoch 11/20
43/43 [==============================] - 153s 4s/step - loss: 0.9991 - accuracy: 0.9801 - val_loss: 0.2755 - val_accuracy: 0.9871

when i run the classification report on the predictions the accuracy is only 50%. why is this happening pls someone explain?

After training many models, I came to know that accuracy doesn't help much. That is why, you should focus on the loss and not much on the accuracy. In this case, I would suggest you to reduce the learning rate, since I can see that the learning is not much stable. Also, I guess that you are not using Batch Normalization layers in your network, due to which you are getting the accuracy as 50%. I can't say much, as you have not provided much details (like you have not provided your model structure, optimizer and loss function you are using). But try reducing the learning rate and introducing Batch Normalization to your model.

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