Chinese characters recognition repository based on CTPN, CRNN
recognize Chinese Characters from image, here shows some results
- WIN 10 or Ubuntu 16.04
- PyTorch 1.2.0 (may fix ctc loss) with cuda 10.0,recommend 1.6.0
- yaml
- easydict
- tensorboardX
- opencv
- pillow
- numpy
[run] python ctpn_crnn.py --image_path images/test_1.png (or change to your image path)
after run above, you could fine result from folder
output/result/result_0.png (or result_1.png depending on how many image you had run)
- crnn (folder)
- include all CRNN scripts
- ctpn_pytorch (folder)
- include all CTPN scripts
- font (folder)
- include some fonts support Chinese
- images (folder)
- include some test images
- output (folder)
- chechkpoints (folder)
- include CRNN checkpoint
- result (folder)
- include test output
- chechkpoints (folder)
- Download CRNN pretrained weights here (password: kze0)
- copy to output/checkpoints/
- Download CTPN pretrained weights here (password: 5bpi)
- copy to ctpn_pytorch/weights/
-
Data set for CRNN training
- 3.6 Million Synthetic Chinese String,download from here , (password: auwl)
-
Edit crnn/lib/config/360cc_config.yaml DATA:ROOT to your image path
-
DATASET:360CC ROOT: "your image path"
-
-
Download labels (password: fwup)
-
Put char_std_5990.txt in lib/dataset/txt/
-
And put train.txt and test.txt in lib/dataset/txt/
eg. test.txt
20456343_4045240981.jpg 89 201 241 178 19 94 19 22 26 656 20457281_3395886438.jpg 120 1061 2 376 78 249 272 272 120 1061 ......
- Edit crnn/lib/config/OWN_config.yaml DATA:ROOT to you image path
DATASET: ROOT: 'to/your/images/path'
-
And put your train_own.txt and test_own.txt in crnn/lib/dataset/txt/
eg. test_own.txt
20456343_4045240981.jpg 你好啊!祖国! 20457281_3395886438.jpg 晚安啊!世界! ...
note: fixed-length training is supported. yet you can modify dataloader to support random length training.
-
Train
[run] cd crnn [run] python train.py --cfg lib/config/360CC_config.yaml or [run] python train.py --cfg lib/config/OWN_config.yaml
loss curve [run] cd output/360CC/crnn/xxxx-xx-xx-xx-xx/ [run] tensorboard --logdir log
-
Test
[run] cd crnn [run] python demo.py --image_path images/test.png --checkpoint output/checkpoints/mixed_second_finetune_acc_97P7.pth
-
Data set for CTPN training,download here (password: ffoq)
this dataset is VOC2007 format
--VOC2007 -- Annotations -- ImageSets -- JPEGImages
-
Edit ctpn_pytorch/ctpn/config.py
img_dir = 'VOC2007/JPEGImages/' label_dir = 'VOC2007/Annotations/'
-
Train
cd ctpn_pytorch python train.py
-
Test
cd ctpn_pytorch python predict.py