0
$\begingroup$

Currently i am working on digit recognizer[0-9]. My model train accuracy 100% and test accuracy 90%. But when i train to feed my own written digit, it always give me wrong prediction.

I know test and train images should come from same source. But how could i feed different source data?

$\endgroup$
3
  • $\begingroup$ from which data set it was trained on ? for example, if you trained it on MNIST (black background and white digits), but use your own images with a white sheet and blue ink to write digit, images are totaly different and can completly fool the model. Your test set should be as smiliar as the train set $\endgroup$ Nov 2, 2018 at 14:22
  • $\begingroup$ @JérémyBlain should i make train and test both background same? If so please give me hints. $\endgroup$
    – Masum
    Nov 2, 2018 at 14:43
  • $\begingroup$ This is important then, edit your post $\endgroup$ Nov 2, 2018 at 15:00

1 Answer 1

3
$\begingroup$

You have to remember that machine learning model do not understand any concepts as we do, humans. It cannot generalize something it hasn't seen. And yours hasn't seen black digits on white background, so it has no way of predicting a digit right.

The only two things you can do is :

  • Train your model from scratch with both datas : black digits on white background and white digits on black background. These datas have to be balanced (as much as possible). Maybe the model need to be more complex, maybe you need more data, and maybe your accuracy will decrease. You can then predict both type of datas.
  • Uses a test dataset only with similar datas of the train set, white digits on black background.

You can also do a data augmentation with your previous train dataset : as the digits are white and background black, you can reverse images color, then you will have black digits on white background. That way, you have your train set doubled in size, without writing any more digits by yourself !

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.