This repository implements the the encoder and decoder model with attention model for OCR, the encoder uses CNN+Bi-LSTM, the decoder uses GRU. This repository is modified from https://github.com/meijieru/crnn.pytorch
Earlier I had an open source version, but had some problems identifying images of fixed width. Recently I modified the model to support image recognition with variable width. The function is the same as CRNN. Due to the time problem, there is no pre-training model this time, which will be updated later.
cd Attention_ocr.pytorch pip install -r requirements.txt
pretrained model coming soon
# path/to/image_name.jpg label path/AttentionData/50843500_2726670787.jpg 情笼罩在他们满是沧桑 path/AttentionData/57724421_3902051606.jpg 心态的松弛决定了比赛 path/AttentionData/52041437_3766953320.jpg 虾的鲜美自是不可待言
cd Attention_ocr.pytorch python train.py --trainlist ./data/ch_train.txt --vallist ./data/ch_test.txt
then you can see in the terminel as follow: there uses the decoderV2 model for decoder.
git checkout AttentionOcrV1