查看网络结构:

(1)利用caffe自带的Python,可以将*.prototxt保存为一张图片,

sudo  python python/draw_net.py  *.prototxt  *.png  --rankdir=BT(或者,TB,LR,RL)

(2)利用Netscope,可以生成网络结构,并带有详细信息,

http://ethereon.github.io/netscope/quickstart.html

http://ethereon.github.io/netscope/#/editor

随机初始化训练:

./build/tools/caffe train --solver=models/bvlc_reference_caffenet/solver.prototxt --gpu=-0,1

微调:

./build/tools/caffe train --solver=models/bvlc_reference_caffenet/solver.prototxt --weights=models/bvlc_reference_caffenet/caffenet_train_iter_10000.caffemodel--gpu=-0,1

从中断处继续训练:

./build/tools/caffe train --solver=models/bvlc_reference_caffenet/solver.prototxt --snapshot=models/bvlc_reference_caffenet/caffenet_train_iter_10000.solverstate

统计在验证集(validation set)上的得分:

./build/tools/caffe test --model= models/bvlc_reference_caffenet/caffenet_train_iter_10000.prototxt--weights= models/bvlc_reference_caffenet/caffenet_train_iter_10000.caffemodel--gpu=0 --iterations=10000

统计训练时间:

# 在 CPU上, 10000iterations训练 caffenet的时间
./build/tools/caffe time --model= models/bvlc_reference_caffenet/caffenet_train_test.prototxt--iterations=10000
# 在 GPU上,默认的 50 iterations训练 caffenet的时间
./build/tools/caffe time --model= models/bvlc_reference_caffenet/caffenet_train_test.prototxt--gpu=0
# 在第一块 GPU上, 10000 iterations训练已给定权值的网络结构的时间
./build/tools/caffe time --model= models/bvlc_reference_caffenet/caffenet_train_test.prototxt--weights= models/bvlc_reference_caffenet/caffenet_train_iter_10000.caffemodel--gpu=0 --iterations=10000

查询GPU显卡参数信息:

# 查询第一块 GPU

./build/tools/caffe device_query --gpu=0

输出训练log日志到txt:

(1)GLOG_logtostderr=0 GLOG_log_dir=./Log/ ./build/tools /caffe  train  --solver=./deepid_solver.prototxt

(2) ./build/tools/caffe train --solver=./deepid_solver.prototxt  >&log.txt&

解析日志:

会在当前文件夹下生成一个.train文件和一个.test文件

./TOOLS/extra/parse_log.sh  *.log

生成曲线图:

./tools/extra/plot_training_log.py.example  0  *.png *.log

Notes:

1. Supporting multiple logs.

2. Log file name must end with the lower-cased ".log".

Supported chart types:

0: Test accuracy  vs. Iters

1: Test accuracy  vs. Seconds

2: Test loss  vs. Iters

3: Test loss  vs. Seconds

4: Train learning rate  vs. Iters

5: Train learning rate  vs.Seconds

6: Train loss  vs. Iters

7: Train loss  vs. Seconds

计算训练数据均值:

# sudo build/tools/compute_image_mean  examples/mnist/mnist_train_lmdbexamples/mnist/mean.binaryproto

生成训练数据的LMDB文件:

convert_imageset  [FLAGS]  ROOTFOLDER/  LISTFILE DB_NAME

FLAGS:

--gray: 是否以灰度图的方式打开图片。程序调用OpenCV库中的imread()函数来打开图片,默认为false

--shuffle: 是否随机打乱图片顺序。默认为false

--backend:需要转换成的db文件格式,可选为leveldb或lmdb,默认为lmdb

--resize_width/resize_height: 改变图片的大小。在运行中,要求所有图片的尺寸一致,因此需要改变图片大小。程序调用opencv库的resize()函数来对图片放大缩小,默认为0,不改变

--check_size: 检查所有的数据是否有相同的尺寸。默认为false,不检查

--encoded: 是否将原图片编码放入最终的数据中,默认为false

--encode_type: 与前一个参数对应,将图片编码为哪一个格式:‘png','jpg'......

ROOTFOLDER:

图片的绝对路径

LISTFILE:

图片txt文件,格式为.txt,内容为,图片  标签

DB_NAME:

保存的文件名

build/tools/convert_imageset --shuffle --resize_height=256 --resize_width=256 /home/xxx/caffe/examples/images/ ./train.txt  ./img_train_lmdb

matlab写caffe程序注意事项:

由于matlab的长宽和c++中opencv的长宽正好相反,同时matlab中是rgb通道,opencv中是bgr通道,因此,程序需要做这么2个变换。这里给出2种处理方式,

(1)直接调用caffe接口,

im_data =caffe.io.load_image('./examples/images/cat.jpg');

(2)用matlab函数自己实现,

im_data = imread('./examples/images/cat.jpg');% read image
im_data = im_data(:, :, [3, 2, 1]); % 从 RGB转换为 BGR
im_data = permute(im_data, [2, 1, 3]); % 改变 width与 height位置
im_data = single(im_data); % 转换为单精度

caffe模型转tensorflow工具:

https://github.com/ethereon/caffe-tensorflow

手动标注图像,生成VOC支持的XML文件工具:

https://github.com/tzutalin/labelImg

matlab将caffe模型weights中不需要的部分去掉:

去掉模型的最后一个全连接层参数,减少模型的大小,适用于只提取特征而不进行分类的开集合场景应用。

net = caffe.NET('XX_deploy.prototxt', 'XX.caffemodel', 'test');

net.save('XX_remove_the_last_fc.caffemodel');

caffe操作技巧的更多相关文章

  1. 用Excel做出比肩任务管理软件的操作技巧

    用Excel做出比肩任务管理软件的操作技巧 在项目管理中,网上有各种各样的工具可以选择,到底用哪个,曾一度困扰着我.我是一个有轻度强迫症的人,总是喜欢试用各种各样的系统,以比较他们之间的不同,试图选择 ...

  2. Jquery数组操作技巧

    Jquery对数组的操作技巧. 1. $.each(array, [callback]) 遍历[常用]  解释: 不同于例遍 jQuery 对象的 $.each() 方法,此方法可用于例遍任何对象(不 ...

  3. Vi操作技巧

    Vi操作技巧: :nu    显示当前所在行的行号 :set nu    显示全部行号 :set nonu        取消显示行号 /字符串    查询字符串,按n查询下一个,按N查询上一个 持续 ...

  4. vim常用操作技巧与配置

    vi是linux与unix下的常用文本编辑器,其运行稳定,使用方便,本文将分两部分对其常用操作技巧和配置进行阐述,其中参考了网上的一些文章,对作者表示感谢 PART1 操作技巧 说明: 以下的例子中  ...

  5. [eclipse] 三个操作技巧

    [eclipse] 三个操作技巧 1.快捷键Ctrl+Shift+i:Debug调试中直接获取方法的返回值 在下图代码中,想知道getHost(),则在调试时运行完该句代码后,选中"urlU ...

  6. eclipse 终极操作技巧

    eclipse作为一个java开发必备软件,从用户体验来说,还是蛮一般的(按照初始设置的话),所以有必要进行一些设置上的改良,加上对一些好用的快捷键的挖掘,能让你用eclipse更加得心应手,事半功倍 ...

  7. 第八章 Hibernate数据操作技巧

    第八章   Hibernate数据操作技巧8.1 分组统计数据    语法:[select]... from ...[where] [group by...[having...]] [order by ...

  8. 转:Mac操作技巧 | "键盘侠"必备快捷键

    看到一篇网友整理的比较好的“Mac操作技巧 | "键盘侠"必备快捷键”,转载过来分享给大家!希望能有帮助. 更多专题,可关注小编[磨人的小妖精],查看我的文章,也可上[风云社区 S ...

  9. PDF文件转换成Excel表格的操作技巧

    我们都知道2007以上版本的Office文档,是可以直接将文档转存为PDF格式文档的.那么反过来,PDF文档可以转换成其他格式的文档吗?这是大家都比较好奇的话题.如果可以以其他格式进行保存,就可以极大 ...

随机推荐

  1. C++ 实现sqilte创建数据库插入、更新、查询、删除

    C/C++ Interface APIs Following are important C/C++ SQLite interface routines, which can suffice your ...

  2. (9)进程---JoinableQueue队列

    消费者模型-->存和取得过程 和Queue队列区别:解决了Queue队列拿取完,程序阻塞不能自动关闭(依靠放入None来解决)的问题--->参见上个例子 put 存入, get 获取 q. ...

  3. MyBatis-session-SqlSession

    The SqlSession instance is the most powerful in MyBatis. It is where you'll find all of the methods ...

  4. validateRequest 相关的作用

    在 Web 应用程序中,要阻止依赖于恶意输入字符串的黑客攻击,约束和验证用户输入是必不可少的.跨站点脚本攻击就是此类攻击的一个示例.其他类型的恶意数据或不需 要的数据可以通过各种形式的输入在请求中传入 ...

  5. 2019/01/17 基于windows使用fabric将gitlab的文件远程同步到服务器(git)

    觉得django项目把本地更新push到gitlab,再执行fabric脚本从gitlab更新服务器项目挺方便的,当然从本地直接到服务器就比较灵活. 2019/01/17 基于windows使用fab ...

  6. 2017.6.5项目总结(移动端touch事件)

    event.stopPropagation()  该方法将停止事件的传播,阻止它被分派到其他Document节点.在时间传播的任何阶段都可以调用它,注意,虽然该方法不能阻止同一个Document节点上 ...

  7. PHP工厂模式demo

    <?php//工厂模式 interface operstion{ function oper($a,$b);}//加class add implements operstion{ functio ...

  8. chmod 没有x权限怎么办

    解决方法1:    # /lib64/ld-linux-x86-64.so.2 /bin/chmod 755 /bin/chmod   //linux动态命令库   解决方法2:方法2提到的两种方法形 ...

  9. Composer 的autoload 实现

    require_once './vendor/autoload.php'; 一.autoload.php 加载 composer/autoload_real.php 调用 autoload_real. ...

  10. 『MXNet』第六弹_Gluon性能提升

    一.符号式编程 1.命令式编程和符号式编程 命令式: def add(a, b): return a + b def fancy_func(a, b, c, d): e = add(a, b) f = ...