caffe保存訓(xùn)練log日志文件并利用保存的log文件繪制accuary loss曲線圖

1、訓(xùn)練模型時(shí)保存log日志文件

方法1 ? 一般情況下我們的訓(xùn)練模型標(biāo)準(zhǔn)語句是:$ sudo? ./build/tools/caffe train -solver=xxx/xxx/solver.prototxt?????? xxx/xxx/表示你的solver.prototxt文件所在位置

?需要保存log文件時(shí)的命令是:$ sudo GLOG_logtostderr=0 GLOG_log_dir='xxx/xxx/xxx/' build/tools/caffe train -solver=xxx/xxx/solver.prototxt ? ?? ’xxx/xxx/xxx/‘表示你所保存的log文件所在位置。

?????? 訓(xùn)練完成后發(fā)現(xiàn)在我們保存的目錄xxx/xxx/xxx/下生成了兩個(gè)上鎖log文件caffe.INFO和caffe.ubuntu.root.log.INFO.20170611-103712.5383。點(diǎn)擊打開后我們可以看到我們所訓(xùn)練的日志文件。

方法2??? ./build/tools/caffe train -solver=xn/PENLU/neural/nin/nin_solver.prototxt 2>&1 | tee xn/PENLU/snapshot/nin/nin_relu.log

2、利用生成的log文件繪制accuary loss曲線圖

首先繪制圖,caffe中其實(shí)已經(jīng)自帶了這樣的小工具 caffe-master/tools/extra/parse_log.sh? 和caffe-master/tools/extra/extract_seconds.py還有 caffe-master/tools/extra/plot_training_log.py.example;拷貝以上文件到當(dāng)前訓(xùn)練模型的目錄下。

????? 然后我們到你保存的log文件目錄下將1中保存的log文件解鎖,解鎖命令:sudo chmod -R 777 ./caffe.ubuntu.root.log.INFO.20170611-103712.5383

????? 解鎖后我們就可以更改該log文件名為xxx.log(注意:要畫圖一定是.log文件,所以不改名不可以畫)。

然后復(fù)制該xxx.log文件到你訓(xùn)練模型所在目錄下。

? ? ? 然后就可以利用命令畫圖了:在模型所在目錄下命令: ./plot_training_log.py.example y xxx.png xxx.log????? xxx.png是你保存的繪制出的圖片名稱,xxx.log是你保存的log文件名稱。y表示的是你的所繪制的圖片到底是什么圖片,具體解釋如下:

???????y的數(shù)字代表意義(0~7):

Supported chart types:??? 0: Test accuracy? vs. Iters??? (準(zhǔn)確率與迭代次數(shù)圖)

1: Test accuracy? vs. Seconds??? (準(zhǔn)確率與時(shí)間圖)

2: Test loss? vs. Iters??? (測(cè)試損失與迭代次數(shù)圖)

3: Test loss? vs. Seconds??? (測(cè)試損失與時(shí)間圖)

4: Train learning rate? vs. Iters??? (學(xué)習(xí)率與迭代次數(shù)圖)

5: Train learning rate? vs. Seconds??? (學(xué)習(xí)率與時(shí)間圖)

6: Train loss? vs. Iters??? (訓(xùn)練損失與迭代次數(shù)圖)

7: Train loss? vs. Seconds ? (訓(xùn)練損失與時(shí)間圖)

運(yùn)行后生成的文件有:log-data.log.test和log-data.log.test和xxx.png

3、test測(cè)試log日志文件保存與繪圖類似過程

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容