问题
I'm currently using a resnet built in keras to do two class classification. I am using model checkpoint to save the best models based off of validation accuracy. Better and better models are saved until I go through all my datapoints a few times. Keras keeps saving new models showing they have higher accuracy but when I test the models they perform worse than previous models.
Here is an output of testing each model with validation data. The first number in the model name is the epoch, the last number is accuracy according to keras.
- 03-0.90.hdf5, Wrong predictions on A: 176, Wrong predictions on B: 1652, total errors 1828
- 04-0.91.hdf5, Wrong predictions on A: 246, Wrong predictions on B: 1448, total errors 1694
- 06-0.92.hdf5, Wrong predictions on A: 135, Wrong predictions on B: 1738, total errors 1873
- 09-0.92.hdf5, Wrong predictions on A: 117, Wrong predictions on B: 1738, total errors 1855
- 10-0.92.hdf5, Wrong predictions on A: 183, Wrong predictions on B: 1208, total errors 1391
- 15-0.92.hdf5, Wrong predictions on A: 64, Wrong predictions on B: 2973, total errors 3037
- 23-0.93.hdf5, Wrong predictions on A: 119, Wrong predictions on B: 2511, total errors 2630
- 26-0.93.hdf5, Wrong predictions on A: 113, Wrong predictions on B: 1794, total errors 1907
- 27-0.93.hdf5, Wrong predictions on A: 85, Wrong predictions on B: 2821, total errors 2906
...
- 1049-0.97.hdf5, Wrong predictions on A: 31, Wrong predictions on B: 5949, total errors 5980
- 1089-0.97.hdf5, Wrong predictions on A: 3, Wrong predictions on B: 6137, total errors 6140
- 1092-0.97.hdf5, Wrong predictions on A: 6, Wrong predictions on B: 6325, total errors 6331
- 1095-0.97.hdf5, Wrong predictions on A: 0, Wrong predictions on B: 6408, total errors 6408
- 1126-0.97.hdf5, Wrong predictions on A: 0, Wrong predictions on B: 6413, total errors 6413
As you can see, it seems the model is improving accuracy at predicting A even though accuracy on B is dropping more than A is improving.
Edit: Here is my code https://github.com/tan2684/Modified-Keras-Resnet
来源:https://stackoverflow.com/questions/43566949/accuracy-gets-worse-the-longer-i-train-a-keras-model