参考: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下caffe的命令运行脚本的更多相关文章

  1. Linux下的Source命令及脚本的执行方式解析

    Linux Source命令及脚本的执行方式解析 http://blog.csdn.net/wangyangkobe/article/details/6595143 当我修改了/etc/profile ...

  2. linux下实时监测命令运行结果工具:watch

    watch是一个非常实用的工具,可以实时监测一些经常变化的命令结果或文件,而不需要手动一次一次的输入命令. 语法: watch [选项] [命令参数] 选项: -n :指定刷新间隔时间,默认2秒. - ...

  3. 怎么在linux下创建一个可运行脚本?

    1.touch hello.sh 2.vim hello.sh键入i插入#!/bin/shecho hello world;键入:esc:wq3.chmod 700 hello.sh 4. 执行./h ...

  4. Linux下java nohup 后台运行关闭后进程停止的原因,不挂断后台运行命令

    Linux下java nohup 后台运行关闭后进程停止的原因,不挂断后台运行命令 今天写sh脚本发现一终止命令程序就停止运行了,检查了很久才发现后面少了个&字符导致的!错误写法:nohup ...

  5. Linux下使Shell 命令脱离终端在后台运行

    --Linux下使Shell 命令脱离终端在后台运行------------------------------------2014/02/14你是否遇到过这样的情况:从终端软件登录远程的Linux主 ...

  6. 【java】 linux下利用nohup后台运行jar文件包程序

    Linux 运行jar包命令如下: 方式一: java -jar XXX.jar 特点:当前ssh窗口被锁定,可按CTRL + C打断程序运行,或直接关闭窗口,程序退出 那如何让窗口不锁定? 方式二 ...

  7. [转] 关于linux下通过shell命令(自动)修改用户密码

    关于linux下通过shell命令(自动)修改用户密码 2012-04-23 18:47:39 分类: 原文地址:关于linux下(自动)修改用户密码 作者:ubuntuer 本文章总结了如何手动.自 ...

  8. 将linux下的rm命令改造成移动文件至回收站【转】

    转自:http://blog.csdn.net/a3470194/article/details/16863803 [-] 将linux下的rm命令改造成移动文件至回收站 将AIX下的rm命令改造成移 ...

  9. 在linux下,查看一个运行中的程序, 占用了多少内存

    1. 在linux下,查看一个运行中的程序, 占用了多少内存, 一般的命令有 (1). ps aux: 其中  VSZ(或VSS)列 表示,程序占用了多少虚拟内存. RSS列 表示, 程序占用了多少物 ...

随机推荐

  1. Linux内核调试方法总结之bugreport

    bugreport [用途]Android性能分析工具,bugreport记录了Android启动过程日志,启动后的系统状态,包括进程列表.内存信息.VM信息等 [使用方法] Adb bugrepor ...

  2. 带有ir的单词

    hire thirty thirteen third sir birthday shirt stir circle dirty skirt affirm affirmation affirmable ...

  3. DRF的路由生成类的使用

    DRF路由生成类的使用 对于视图集ViewSet,我们除了可以自己手动指明请求方式与动作action之间的对应关系外,还可以使用Routers来帮助我们快速实现路由信息. REST framework ...

  4. Week 9 - 638.Shopping Offers - Medium

    638.Shopping Offers - Medium In LeetCode Store, there are some kinds of items to sell. Each item has ...

  5. 1.k8s.资源清单

    #k8s常用资源 工作负载:Pod,rs(ReplicasSet),deploy(Deployment),sts(StatefulSet),ds(DaemonSet),Job,Cronjob 服务发现 ...

  6. linux下vscode备忘

    vscode如何自定义,如何方便地编写c/c++vscode支持vim.sublime快捷键,在设置->keymap可以安装相应插件vscode默认的快捷键支持自定义,打开keyboard sh ...

  7. LeetCode——707 设计链表

    题目: 总而言之就是要用C++手撸链表,我的代码: class MyLinkedList { public: /** Initialize your data structure here. */ M ...

  8. hacker101教学笔记--introduction--the web in depth

    hacker101笔记 提前准备:运行java的环境 burp proxy(代理) firefox(浏览器) xss 可以控制参数,发送JavaScript到服务器,再从服务器反映到浏览器上面< ...

  9. 四种pop模式介绍

    四种pop模式介绍 URL:http://www.hishop.com.cn/ecschool/jd/show_21195.html URL:https://zhidao.baidu.com/ques ...

  10. ios平台appstore不支持网页内嵌app解决方案

    苹果一直拒绝 UIWebView 内嵌 HTML5 页面的 iPhone.iPad APP应用上架到 App Store,建议这样的APP去做成Safari的Web应用.但是,苹果的审核人员只从界面. ...