天天看點

Chinese-ocr重新訓練,ctpn + crnnChinese-ocr重新訓練,ctpn + crnn

Chinese-ocr重新訓練,ctpn + crnn

項目代碼參考:https://gitee.com/rothsword/CHINESE-OCR

ctpn訓練

注:見上一篇

crnn訓練

1.預訓練參數和路徑比對

• keras版本 ./train/keras_train/train_batch.py model_path–指向預訓練權重位置 MODEL_PATH—指向模型訓練儲存的位置

keras模型預訓練權重:https://pan.baidu.com/s/1vTG6-i_bFMWxQ_7xF06usg

• pythorch版本./train/pytorch-train/crnn_main.py

parser.add_argument(

‘–crnn’,

help=“path to crnn (to continue training)”,

default=預訓練權重的路徑,看你下載下傳的預訓練權重在哪啦)

parser.add_argument(

‘–experiment’,

help=‘Where to store samples and models’,

default=模型訓練的權重儲存位置,這個自己指定)

pytorch預訓練權重:https://pan.baidu.com/s/1LEDNHEr3luloB7eZK6GOeA

2.訓練資料

運作create-dataset.sh檔案生成訓練資料

3.重新訓練

(注意修改檔案中的加載和儲存模型的路徑)

運作train-keras.sh或train-pytorch.sh

4.測試

項目/orc/model.py修改模型加載路徑

modelPath = os.path.join(os.getcwd(), “模型儲存路徑”)

運作demo即可

繼續閱讀