0

When testing the classification and recognition of handwritten Chinese characters, I tested the actual image after training the model. I just observed the test results and put hundreds of test images. Finally, there are only a few that recognize and classify correctly, which is very different from the accuracy rate close to 1 obtained in the previous training process.

What aspects can be adjusted next? After adjusting the parameters such as the learning rate and batch_size, I found that the test accuracy is still 1, and I have been troubled by this confusion for a long time.

Here are partial results of training:

===============Eval a batch=======================
the step 29951.0 test accuracy: 0.984375
===============Eval a batch=======================
the step 29952.0 takes 0.17307710647583008 loss 0.0008665836066938937
the step 29953.0 takes 0.25222134590148926 loss 0.0005434205522760749
the step 29954.0 takes 0.3887183666229248 loss 0.003525803331285715
the step 29955.0 takes 0.23599553108215332 loss 0.0003706887364387512
the step 29956.0 takes 0.26450228691101074 loss 0.0006313278572633862
the step 29957.0 takes 0.34571290016174316 loss 0.0182876605540514
the step 29958.0 takes 0.5547871589660645 loss 0.0026430373545736074
the step 29959.0 takes 0.38457441329956055 loss 0.0007898558978922665
the step 29960.0 takes 0.16958928108215332 loss 0.006326956208795309
the step 29961.0 takes 0.06468939781188965 loss 0.000736367772333324
the step 29962.0 takes 0.11962270736694336 loss 0.0005897910450585186
the step 29963.0 takes 0.5162458419799805 loss 0.0017055184580385685
...
the step 29999.0 takes 0.14566969871520996 loss 0.0004975588526576757
the step 30000.0 takes 0.3823719024658203 loss 0.00029294786509126425
the step 30001.0 takes 0.3407578468322754 loss 0.0002459493698552251
===============Eval a batch=======================
the step 30001.0 test accuracy: 1.0
===============Eval a batch=======================
Save the ckpt of 30001.0
the step 30002.0 takes 0.013458967208862305 loss 0.00033156140125356615
the step 30003.0 takes 0.012116432189941406 loss 0.0007762557361274958
desertnaut
  • 57,590
  • 26
  • 140
  • 166
  • What is the separation between your test and train datasets? If you're testing your accuracy against the same data that you're using for training, then you'll get an accuracy of 1, while still getting non-perfect results on new data. Could it be that you should hold back some data for performing your in-training accuracy tests that isn't included in your training batches? – Thomas Kimber Jun 08 '20 at 10:52
  • The training data and test data are separated. And the image used for new data verification is also different from the training data and test data. – suifengingo Jun 08 '20 at 11:11
  • There's some discussion of this here: https://stackoverflow.com/questions/34518656/how-to-interpret-loss-and-accuracy-for-a-machine-learning-model But intuitively, I imagine your model is overfitting. You could try randomising what is used for test, train and final prediction - if you randomise enough, you can sometimes foil your network's natural trend towards overfitting. – Thomas Kimber Jun 08 '20 at 11:22

0 Answers0