Original Paper: An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application to Scene Text Recognition
Original Code: http://github.com/bgshih/crnn
If you want an end to end OCR service, check this repo: https://github.com/Sanster/DeepOcrService
sudo pip3 install -r requirement.txt
Check Text Renderer to see how to generate images for training, or you can download pre-generated image from here Coming soon
Supported base cnn network and corresponding hyper parameters are stored in ./data/cfgs/
folder.
python3 train.py \
--tag=2018_11_26 \
--train_dir=path/to/your/training/images \
--val_dir=path/to/your/val/images \
--test_dir=path/to/your/test/images \
--chars_file=./data/chars/chn.txt \
--cfg_name=raw \
--gpu
Download pretrained model from here, extract it in ./output/checkpoint/default
, than run:
Images in ./data/demo
should have 32px height.
python3 infer.py \
--infer_dir=./data/demo \
--chars_file=./data/chars/chn.txt \
--infer_batch_size=1 \
--ckpt_dir=./output/checkpoint \
--result_dir=./output/result \
--tag=default
Output:
Batch [0/7] 2.772s accuracy: 1.000 (1/1), edit_distance: 0.0
Batch [1/7] 0.053s accuracy: 1.000 (1/1), edit_distance: 0.0
Batch [2/7] 0.054s accuracy: 1.000 (1/1), edit_distance: 0.0
Batch [3/7] 0.055s accuracy: 1.000 (1/1), edit_distance: 0.0
Batch [4/7] 0.054s accuracy: 1.000 (1/1), edit_distance: 0.0
Batch [5/7] 0.053s accuracy: 1.000 (1/1), edit_distance: 0.0
Batch [6/7] 0.056s accuracy: 1.000 (1/1), edit_distance: 0.0
Accuracy: 1.000 (7/7), Average edit distance: 0.000
Write result to ./output/result/default/infer/1.000.txt
Test result on chinese dataset from caffe-ocr
Network | lstm | Epochs | Training time | Test Acc | Edit Distance |
---|---|---|---|---|---|
PaperCnn | 0 | 0 | |||
SimpleNet | 0 | 0 | |||
DenseNet | 0 | 0 | |||
Resnet | 0 | 0 | |||
SqueezeNet | 0 | 0 |
Test result on dataset generated by Text Renderer
Network | lstm | Epochs | Training time | Test Acc | Edit Distance |
---|---|---|---|---|---|
PaperCnn | 0 | 0 | |||
SimpleNet | 0 | 0 | |||
DenseNet | 0 | 0 | |||
Resnet | 0 | 0 | |||
SqueezeNet | 0 | 0 |
- Edit distance only count error results