Crnn_Ctpn_Unified
Unified text detection and recognition
First of all, thanks for the author of crnn and ctpn algorithm with opening their codes. Here is crnn original codes, here is ctpn original codes and a tensorflow version can be found here
In my repository, ctpn was built in tensorflow, meanwile crnn was built in pytorch
Environment
Ubuntu16.04(it's more appropriate to build warp-ctc than other)
python3
tensorflow-gpu(version>=1.6)
pytorch(version>=0.3)
warp-ctc click here to download, follow the author to build warp-ctc
cuda 9.0 and cudnn 7.0
Just using pip to establish your dev environment, eg. pip install tensorflow-gpu==1.6, pip install torchvesion(it will install pytorch meanwhile)
Performance
Images and results will be stored in detect_data file.
cd end2endDec_Rec
python3 ./ctpn_crnn_combined/end2endDet_Rec.py
Results
results were saved in detect_data/txt_results
Training data
Here I just share the method that was used to train a crnn model. In my training, ultimately it reached an accuracy of 97.8%. Before training, you should generate a lmdb dataset. Click here for downloading a 3.6 million chinese characters training sets. Or just download the lmdb datasets that were generated by myself.
Here are some examples about chinese characters training data.
if you want to create it by yourself, you can reference dataset_preprocess directory.
Train crnn models
cd train_crnn
python3 crnn_main.py --trainroot lmdb_data_set/xxx --valroot lmdb_data_set/xxx (--cuda)