caffe在solverstate的基礎上繼續訓練模型


以mnist數據集為例:

bat訓練腳本:

Build\x64\Release\caffe.exe train --solver=examples/mnist/lenet_solver.prototxt 
pause 

  

在這個模型的基礎上,繼續訓練。

繼續訓練之前,也可以修改lenet_solver.prototxt中的學習率。

Build\x64\Release\caffe.exe train --solver=examples/mnist/lenet_solver.prototxt --snapshot=examples/mnist/lenet_iter_1000.solverstate
pause 

 訓練從1000次iterations開始。

 

用Python腳本啟動訓練:

import caffe

caffe.set_device(int(0))
caffe.set_mode_gpu()

solver = caffe.SGDSolver('.\\examples\\mnist\\lenet_solver.prototxt')
solver.solve()

加載已訓練的模型,只用加一句話

import caffe

caffe.set_device(int(0))
caffe.set_mode_gpu()

solver = caffe.SGDSolver('.\\examples\\mnist\\lenet_solver.prototxt')
solver.restore('examples\\mnist\\lenet_iter_5000.solverstate')
solver.solve()

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM