1、数据。mnist_test_lmdb和mnist_train_lmdb数据
2、路径。
(1)修改lenet_train_test.prototxt文件,训练和测试两处
source: "....省略/examples/mnist/mnist-train-leveldb" //写上你的绝对路径 backend: LEVELDB //格式改成LEVELDB
(2)修改lenet_solver.prototxt文件:
net: "....省略/examples/mnist/lenet_train_test.prototxt" //绝对路径 snapshot_prefix: "....省略/examples/mnist/lenet" //绝对路径 solver_mode: CPU //CPU模式
3、右键caffe打开属性:
在Command Arguments输入: train --solver=前面的绝对路径/mnist/lenet_solver.prototxt
4、 确定后debug caffe,大功告成!
1、训练完后,会生成lenet_iter_5000.caffemodel,lenet_iter_5000.solverstate,lenet_iter_10000.caffemodel,lenet_iter_10000.solverstate四个文件
2、产生均值文件
计算均值文件:在E:CaffeDev-GPUcaffe-masterBuildx64Release目录下新建bat文件mnist_mean.bat,内容如下:
D:/caffewin/caffe-master/Build/x64/Debug/compute_image_mean.exe D:/caffewin/caffe-master/examples/mnist/mnist_train_lmdb mean.binaryproto --backend=lmdb
pause
双击运行
得到mean.binaryproto
3、新建mnist_test.bat
D:/caffewin/caffe-master/Build/x64/Debug/caffe.exe test --model=D:/caffewin/caffe-master/examples/mnist/lenet_train_test.prototxt --weights=D:/caffewin/caffe-master/examples/mnist/lenet_iter_10000.caffemodel
pause
双击运行
4、测试图片
新建test.bat文件,写入
D:caffewincaffe-masterBuildx64Debugclassification.exe D:caffewincaffe-masterexamplesmnistlenet.prototxt D:caffewincaffe-masterexamplesmnistlenet_iter_10000.caffemodel D:caffewincaffe-masterexamplesmnistmean.binaryproto D:caffewincaffe-masterexamplesmnistwords.txt D:caffewincaffe-masterexamplesmnist2.bmp pause
双击运行即可