https://github.com/diaomin/crnn-mxnet-chinese-text-recognition
An implementation of CRNN (CNN+LSTM+warpCTC) on MxNet for chinese text recognition
https://github.com/diaomin/crnn-mxnet-chinese-text-recognition
chinese-text-recognition cnn-lstm-ctc crnn mxnet ocr
Last synced: 5 months ago
JSON representation
An implementation of CRNN (CNN+LSTM+warpCTC) on MxNet for chinese text recognition
- Host: GitHub
- URL: https://github.com/diaomin/crnn-mxnet-chinese-text-recognition
- Owner: diaomin
- Created: 2018-04-06T08:38:56.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-02-11T15:50:30.000Z (about 2 years ago)
- Last Synced: 2024-08-01T22:41:28.987Z (9 months ago)
- Topics: chinese-text-recognition, cnn-lstm-ctc, crnn, mxnet, ocr
- Language: Python
- Size: 38.1 KB
- Stars: 209
- Watchers: 10
- Forks: 551
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- Awesome-MXNet - [Chinese
README
# crnn-mxnet-chinese-text-recognition
This is an implementation of CRNN (CNN+LSTM+CTC) for chinese text recognition.## Building MXNet with warp-ctc
1. In order to use `mxnet.symbol.WarpCTC` layer, you need to first build Baidu's [warp-ctc](https://github.com/baidu-research/warp-ctc) library from source
2. Then build MXNet from source with warp-ctc config flags enabled.## Data Preparation
1. Download the [Synthetic Chinese Dataset](https://pan.baidu.com/s/1dFda6R3)(contributed by https://github.com/senlinuc/caffe_ocr and many thanks)A glance of the dataset:
* almost 3.6 million synthetic chinese text images.
* 5,990 different categories in total.
* each image has a length of 10 characters.
2. Create train.txt and text.txt with the format like this:
```
image_name1 label1_1 label1_2 label1_3...
image_name2 label2_1 label2_2 label2_3...
```
Optional: downoad the two files [here](https://pan.baidu.com/s/1xQ38TTUrxMytVp1VY6Y4Pg)## Training
1. Modify the path of images and txt files in train.py
2. Run
```
$ python train.py 2>&1 | tee log.txt
```
3. After almost 19 epoches, you can get 99.0502% validation accuracy.
```
2018-04-01 03:35:35,136 Epoch[18] Batch [25450] Speed: 53.10 samples/sec accuracy=0.988125
2018-04-01 03:37:37,482 Epoch[18] Batch [25500] Speed: 52.31 samples/sec accuracy=0.986719
2018-04-01 03:39:38,613 Epoch[18] Batch [25550] Speed: 52.84 samples/sec accuracy=0.989531
2018-04-01 03:41:40,470 Epoch[18] Batch [25600] Speed: 52.52 samples/sec accuracy=0.987969
2018-04-01 03:42:27,544 Epoch[18] Train-accuracy=0.988672
2018-04-01 03:42:27,544 Epoch[18] Time cost=80796.510
2018-04-01 03:42:27,610 Saved checkpoint to "./check_points/model-0019.params"
2018-04-01 05:34:43,096 Epoch[18] Validation-accuracy=0.990502
```
Hare is a [pre-trained model](https://pan.baidu.com/s/1iwOVZJxF-P14LemziisLwA) you can download directly.