Extracting numbers from bankcard, based on Deep Learning with Keras.
Including auto and manual location, number identification, with GUI.
中文BLOG: 点击此处链接
Python == 3.6
pip install requirements
Windows10 x64, Anaconda, PyCharm 2018.3, NVIDIA GTX 1050.
6eqw
,
EAST extracting-code:qiw5
. crnn/model
, put EAST model into east/model
.python demo.py
.Load
button to load one image about bankcard or load from dataset/test/
. Identify
button, it will start locate and do identification.Identify
.Download my dataset, CRNN extracting-code:1jax
,
EAST extracting-code:pqba
. and unzip dataset in ./dataset
.
The structure of dataset
looks like:
- dataset
- /card # for east
- /crad_nbr # for crnn
- /test
...
python crnn/preprocess.py
.python crnn/run.py
to train, and you can change some parameters in crnn/cfg.py
.dataset/card/txt/
.
This tiny dataset is unable to cover all the situation, if you have rich one, it may perform better.dataset/tagger.py
to label it.east/cfg.py
, see default values.python east/preprocess.py
. If process goes well, you'll see generated data like this:python east/run.py
.The model I used, refer to CNN_RNN_CTC. The CNN part is using VGG, with BLSTM as RNN and CTC loss.
The model's preview:
Auto locate is using one famous Text Detection Algorithm - EAST. See more details.
In this project, I prefer to use AdvancedEAST. It is an algorithm used for Scene-Image-Text-Detection, which is primarily based on EAST, and the significant improvement was also made, which make long text predictions more accurate. Original repo see Reference 1.
Also, training process is quiet quick and nice. As practical experience, img_size is better to be 384. The epoch_nbr
is no longer important any more, for img_size like 384, usually training will early stop at epoch 20-22. But if you have a large dataset, try to play with these parameters.
This model's preview:
Manual locate is only available in GUI. Here're some performance in .gif:
Using QtDesigner to design UI, and PyQt5 to finish other works.