This software implements the Convolutional Recurrent Neural Network (CRNN) in pytorch. Origin software could be found in crnn
- Python 3.8
- PyTorch 1.10
A demo program can be found in demo.py
. Before running the demo, download a pretrained model
from Baidu Netdisk or Dropbox.
This pretrained model is converted from auther offered one by tool
.
Put the downloaded model file crnn.pth
into directory data/
. Then launch the demo by:
python demo.py
The demo reads an example image and recognizes its text content.
Expected output: loading pretrained model from ./data/crnn.pth a-----v--a-i-l-a-bb-l-ee-- => available
- warp_ctc_pytorch
- lmdb
- Construct dataset following origin guide. If you want to train with variable length images (keep the origin ratio for example), please modify the
tool/create_dataset.py
and sort the image according to the text length. - Execute
python train.py --adadelta --trainRoot {train_path} --valRoot {val_path} --cuda --alphabet {vocabulary}
. Exploretrain.py
for details. Thedataset.py
will auto add blank label_
to index blank index 0.
- Use
torch.CTCLoss
for easy environment creating. - Port to Python 3, does not support Python 2 now.
- The pres and loss are NAN after several steps.