caffe 相关命令

训练网络命令:

sudo sh ./build/tools/caffe train --solver=examples/mnist/train_lenet.sh

-solver:必选参数。一个protocol buffer类型的文件,即模型的配置文件。如:

./build/tools/caffe train -solver examples/mnist/lenet_solver.prototxt

-gpu: 可选参数。该参数用来指定用哪一块gpu运行,根据gpu的id进行选择,如果设置为’-gpu all’则使用所有的gpu运行。如使用第三块gpu运行:

./build/tools/caffe train -solver examples/mnist/lenet_solver.prototxt -gpu 2

-weights:可选参数。用预先训练好的权重来fine-tuning模型,需要一个caffemodel如:

./build/tools/caffe train 
-solver examples/finetuning_on_flickr_style/solver.prototxt 
-weights models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel

测试网络

./build/tools/caffe test 
-model examples/mnist/lenet_train_test.prototxt 
-weights examples/mnist/lenet_iter_10000.caffemodel 
-gpu 0 
-iterations 100

time参数用来在屏幕上显示程序运行时间。如:

./build/tools/caffe time -model examples/mnist/lenet_train_test.prototxt -iterations 10

关于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

绘制网络

1、安装graphViz

sudo apt-get install graphviz

2 、安装pydot

sudo pip install pydot

绘制网络:

sudo python /home/tyd/caffe/python/draw_net.py 
/home/tyd/caffe/examples/mnist/lenet_train_test.prototxt 
/home/tyd/caffe_case/lenet.png 
--rankdir=BT

第一个参数:网络模型的prototxt文件

第二个参数:保存的图片路径及名字

第二个参数:–rankdir=x , x 有四种选项,分别是LR, RL, TB, BT 。用来表示网络的方向,分别是从左到右,从右到左,从上到小,从下到上。默认为LR。

均值

对已经转换成LMDB的数据文件进行减均值计算

sudo /home/tyd/caffe/build/tools/compute_image_mean 
/home/tyd/caffe/examples/mnist/mnist_train_lmdb 
/home/tyd/caffe_case/mean.binaryproto
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值