Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 1.11 KB

README.md

File metadata and controls

34 lines (23 loc) · 1.11 KB

Optical Character Recognition

Machine learning OCR with Convolutional Recurrent Neural Network (CRNN). The input shape is (32, 400), so if your dataset has different shapes, you need to resize the inputs or modify the architecture.

How does it work

generate dataset

python3 generate_dateset.py

Train the model

There're many ways to train the model, you can just run python3 crnn-ctc.py on your machine, but it probably has poor performance if you do not have a high-performance GPU (or TPU) and CUDA support. Or you can train your model in the cloud (e.g. AWS), but it's absolutely not free. The way I recommend is Colab, it provides you great GPUs (and TPUs) and is totally free.

You can take a look at ocr.ipynb.

Load pre-trained model

Download best_model.hdf5 and put it into the current directory.

A pre-trained model here: best_model.hdf5

Make a prediction

python3 generate_dataset.py 1 | xargs python3 predict.py