Ausli / chinese_crnn

中文crnn识别

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

chinese_crnn

中文crnn识别以及其模型转onnx

更正(Correction)

更正了原demo图片resize参数错误的问题

环境配置(Dev Environments)

Win10 + torch1.8.1+cu111+cudnn8.1.1

数据(Data)

Synthetic Chinese String Dataset

  1. Download the dataset
  2. Edit lib/config/360CC_config.yaml DATA:ROOT to you image path
    DATASET:
      ROOT: 'to/your/images/path'
  1. Download the labels (password: eaqb)

  2. Put char_std_5990.txt in lib/dataset/txt/

  3. 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
    ...

Or your own data

  1. Edit lib/config/OWN_config.yaml DATA:ROOT to you image path
    DATASET:
      ROOT: 'to/your/images/path'
  1. And put your train_own.txt and test_own.txt in 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)

注:将训练的字符添加至lib/config/alphabets.py后,再进行训练,否则训练将出错

   [run] python train.py --cfg lib/config/360CC_config.yaml
or [run] python train.py --cfg lib/config/OWN_config.yaml
#### loss curve

```angular2html
   [run] cd output/360CC/crnn/xxxx-xx-xx-xx-xx/
   [run] tensorboard --logdir log

演示(Demo)

   [run] python demo.py --image_path images/test.png --checkpoint output/checkpoints/mixed_second_finetune_acc_97P7.pth

转换成onnx模型(Convert to onnx model)

将export_onnx.py的模型位置替换成你自己的位置,在onnx_test.py进行测试

参考资料(References)

https://github.com/Sierkinhane/CRNN_Chinese_Characters_Rec

About

中文crnn识别


Languages

Language:Python 100.0%