0

I have problem with my CNN model.

I have 89 original fundus image with 5 images of a normal class, and 84 images un-normal class. Then, I augmented the normal class with OpenCV, so I have 85 images of normal class and 84 un-normal class.

I trained it with ResNet-50. and I got:

Train on 118 samples, validate on 51 samples
Epoch 1/200
118/118 [==============================] - 9s 80ms/sample - loss: 0.3268 - accuracy: 0.8475 - val_loss: 1260226.0000 - val_accuracy: 0.7549
Epoch 2/200
118/118 [==============================] - 1s 8ms/sample - loss: 0.2474 - accuracy: 0.8771 - val_loss: 114804.7059 - val_accuracy: 0.7549
Epoch 3/200
118/118 [==============================] - 1s 8ms/sample - loss: 0.2740 - accuracy: 0.8390 - val_loss: 6039848.1569 - val_accuracy: 0.7549
Epoch 4/200
118/118 [==============================] - 1s 8ms/sample - loss: 0.1889 - accuracy: 0.9110 - val_loss: 3247823.3725 - val_accuracy: 0.7549
.
.
.
Epoch 32/200
118/118 [==============================] - 1s 8ms/sample - loss: 7.9578e-04 - accuracy: 1.0000 - val_loss: 0.2045 - val_accuracy: 0.9314
Epoch 33/200
112/118 [===========================>..] - ETA: 0s - loss: 2.0889e-04 - accuracy: 1.0000

Epoch 34/200
112/118 [===========================>..] - ETA: 0s - loss: 0.0019 - accuracy: 1.0000
Epoch 00034: val_accuracy did not improve from 0.96078

Epoch 00034: ReduceLROnPlateau reducing learning rate to 1.5625000742147677e-05.
Restoring model weights from the end of the best epoch.
118/118 [==============================] - 1s 9ms/sample - loss: 0.0018 - accuracy: 1.0000 - val_loss: 0.1718 - val_accuracy: 0.9314
Epoch 00034: early stopping

What do you think about this? I am confused because in the first epoch val_loss so high, but in the last epoch, val_loss low. Is it okay? or my model is overfitting?

If my model is wrong, what should I do for getting better results?

Harshil
  • 914
  • 1
  • 12
  • 26
hilyap
  • 1
  • 2

1 Answers1

0

After a long training, the neural network learns very specific patterns which result in a decrease in training loss and an increase in validation loss. In such cases, you can say your model is overfitted.

In your case, I would say your model is a good fit.

If your model starts overfitting, try decreasing the number of parameters of the model to be trained or apply early stopping.

Harshil
  • 914
  • 1
  • 12
  • 26