参考:https://www.cnblogs.com/denny402/p/5076285.html
首先编译:
make -j8
make pycaffe
注:下面的--solver=.... 等价于 -solver ....
########################## -solver:必选参数 ###################
set -e
./build/tools/caffe train
--solver=examples/mnist/lenet_solver.prototxt -gpu 2
#gpu 2表示用第2块gpu运行,如果设置为"-gpu all"表示使用所有的gpu运行
######################-snapshot:可选参数,-gpu:可选参数 #############
#加上断点的训练
set -e
./build/tools/caffe train
--solver=examples/mnist/lenet_solver.prototxt \
--snapshot=examples/mnist/snapshot/lenet_solver_iter_400.solverstate
######################## -weights:可选参数 #################
#用预先训练好的权重来fine-tuning模型,需要一个caffemodel,不能和-snapshot同时使用
set -e
./build/tools/caffe train
--solver=examples/mnist/lenet_solver.prototxt \
#这里放训练好的模型参数caffemodel
--weights=models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel
########### test参数用在测试阶段,用于最终结果的输出,要配置模型中设定输入accuracy或loss,若我们在验证集中已训练好模型,则可以这么写(用caffe自带的测试方法)###################################
./build/tools/caffe test --model=examples/mnist/lenet_train_test.prototxt \
--weights=examples/mnist/lenet_iter_10000.caffemodel -gpu 0 -iterations 100
############## time参数在屏幕上显示程序运行时间 ##################
###########可以在屏幕上显示lenet模型迭代10次所用的时间,包括每次迭代的forward和backward所用的时间##############
############也包括每层forward和backward所用的平均时间###################
./build/tools/caffe time --model=examples/mnist/lenet_train_test.prototxt -gup 0 -iterations 10
########### 利用给定的权重,利用第一块gpu,迭代10次lenet模型所用的时间 #################
./build/tools/caffe time --model=examples/mnist/lenet_train_test.prototxt \
--weights=examples/mnist/lenet_iter_10000.caffemodel -gpu 0 -iterations 10
############### device_query参数诊断gpu信息 ##############
./build/tools/caffe device_query -gpu 0
################# 2个关于gpu的例子 #####################
./build/tools/caffe train --solver=examples/mnist/lenet_solver.prototxt -gpu 0,1
./build/tools/caffe train --solver=examples/mnist/lenet_solver.prototxt -gpu all
#这2个例子说明:用2块或多块GPU来平行运算,速度会快很多;但是如果只有1块或没有GPU,就不要加-gpu参数了,加了反而更慢
#######最后在linux下本身就有1个time命令,因此可以结合使用,因此运行mnist例子的最终命令(1块GPU)############
sudo time ./build/tools/caffe train --solver=examples/mnist/lenet_solver.prototxt
Linux下的Source命令及脚本的执行方式解析
Linux Source命令及脚本的执行方式解析 http://blog.csdn.net/wangyangkobe/article/details/6595143 当我修改了/etc/profile ...
linux下实时监测命令运行结果工具:watch
watch是一个非常实用的工具,可以实时监测一些经常变化的命令结果或文件,而不需要手动一次一次的输入命令. 语法: watch [选项] [命令参数] 选项: -n :指定刷新间隔时间,默认2秒. - ...
怎么在linux下创建一个可运行脚本?
1.touch hello.sh 2.vim hello.sh键入i插入#!/bin/shecho hello world;键入:esc:wq3.chmod 700 hello.sh 4. 执行./h ...
Linux下java nohup 后台运行关闭后进程停止的原因,不挂断后台运行命令
Linux下java nohup 后台运行关闭后进程停止的原因,不挂断后台运行命令 今天写sh脚本发现一终止命令程序就停止运行了,检查了很久才发现后面少了个&字符导致的!错误写法:nohup ...
Linux下使Shell 命令脱离终端在后台运行
--Linux下使Shell 命令脱离终端在后台运行------------------------------------2014/02/14你是否遇到过这样的情况:从终端软件登录远程的Linux主 ...
【java】 linux下利用nohup后台运行jar文件包程序
Linux 运行jar包命令如下: 方式一: java -jar XXX.jar 特点:当前ssh窗口被锁定,可按CTRL + C打断程序运行,或直接关闭窗口,程序退出 那如何让窗口不锁定? 方式二 ...
[转] 关于linux下通过shell命令(自动)修改用户密码