參考:Windows Caffe 學習筆記(三)在Caffe上訓練和測試自己的資料
參考:Caffe_Windows學習筆記(二)用自己的資料訓練和測試CaffeNet
參考:caffe模型訓練全過程(一)腳本、資料準備與制作
參考:Windows10下使用Caffe訓練神經網絡(含資料庫的生成方法)
github資源:https://github.com/senlinuc/caffe_ocr
1、準備資料
比如這個:合成的中文資料(連結:https://pan.baidu.com/s/1TXeZUcpVOUxrtfRtWKMSGg 提取碼:ujjc )
其中,訓練樣本:3279606 測試樣本:364400,共計3644006。
2、轉換資料格式
.\tools_bin\convert_imageset.exe F:\BaiduNetdiskDownload"\Synthetic Chinese String Dataset"\images\ F:\BaiduNetdiskDownload"\Synthetic Chinese String Dataset"\images\train.txt E:\GitHub\caffe_ocr-master\examples\ocr\train_leveldb --shuffle --resize_height=32 --resize_width=280
echo.
.\tools_bin\convert_imageset.exe F:\BaiduNetdiskDownload"\Synthetic Chinese String Dataset"\images\ F:\BaiduNetdiskDownload"\Synthetic Chinese String Dataset"\images\test.txt E:\GitHub\caffe_ocr-master\examples\ocr\test_leveldb --shuffle --resize_height=32 --resize_width=280
pause
需要注意的地方:由于部分路徑中包含空格(“ ”),是以包含空格的部分需要用雙引号包起來,否則就會被可執行程式認為是多個輸入變量。是以路徑中一般不要包含空格。
3、訓練
caffetool.exe train --solver=E:/GitHub/caffe_ocr-master/examples/ocr/densenet/solver.prototxt
如果中間終止後要繼續訓練,可以加載快照繼續訓練。
4、測試
測試可以使用項目中的ocr_test項目測試。