Skip to content

lqy123000/image_ocr

Repository files navigation

image_ocr

Image OCR in Keras.

Introduction

This project is inspired by image_ocr.py in keras examples.

Some main changes are listed as follows:

  • Generate characters in random rather than loading words from file.
  • Change network architecture. BN is added after Conv2D and one BiGRU is removed, since the origin network is found hard to converge.
  • Reduce epochs since BN accelerates training.
  • The function "on_train_begin" seems working in parallel with "fit_generator", so built word list on constructor.
  • Replace cairocffi with PIL. cairocffi relies on GTK which is not easy to install on windows.
  • If font size is too large to paint, try smaller size rather than throw a exception immediately.
  • Rotation range is tuned to avoid string exceeding canvas.
  • Support saving "predict_model".

Results

Test 10240 random images.

  • digits test acc: 99.76% for training 15 epochs
  • English character test acc: 96.16% for training 16 epochs
  • captcha test acc: 82.93% for training 6 epochs (fix length 4)
  • captcha_cnn test acc: 97.06% for training 10 epochs (fix length 4)

References

About

Image OCR in Keras

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages