codeblock配置caffe
来源:互联网 发布:人工智能创意文案 编辑:程序博客网 时间:2024/06/16 18:36
一、前言
由于gdb调试caffe诸多不易,为节约时间,使用codeblock调试caffe,有助于理解caffe源码,这里记录配置过程,这要参考以下博文
二、配置前提
1.安装好caffe,并配置好环境,由于只是为了理解源码,故使用CPU模型,容易配置些,故在Makefile需将以下的注释去掉
CPU_ONLY := 1
OPENCV_VERSION := 3
之后make -j8 && make pycaffe ,再执行 make distribute
2.安装codeblock
三、创建codeblock工程
使用 codeblock 在caffe-master路径下创建empty工程,之后在工程中添加caffe-master/tools/caffe.cpp ;在训练中主要就是使用caffe.bin,caffe.bin是caffe.cpp编译得到的,对工程右键点击选择Build options... ,我只配置了debug的环境。
之后的配置就与这篇博文的一致了 http://blog.csdn.net/geekjzy/article/details/53907556
配置完之后,ctrl+F9 编译发现只是警告没错误
四、输入命令行训练 lenet模型
由于此时使用命令行参数训练lenet模型(还是它),使用的是CPU模式,而且lenet_train_test.prototxt等的位置必须使用绝对路径才能找到,更改lenet_solver.prototxt文件如下:
# The train/test net protocol buffer definitionnet: "/opt/caffe-master/examples/mnist/lenet_train_test.prototxt" //这是 模型文件的绝对路径# test_iter specifies how many forward passes the test should carry out.# In the case of MNIST, we have test batch size 100 and 100 test iterations,# covering the full 10,000 testing images.test_iter: 100# Carry out testing every 500 training iterations.test_interval: 500# The base learning rate, momentum and the weight decay of the network.base_lr: 0.01momentum: 0.9weight_decay: 0.0005# The learning rate policylr_policy: "inv"gamma: 0.0001power: 0.75# Display every 100 iterationsdisplay: 100# The maximum number of iterationsmax_iter: 10000# snapshot intermediate resultssnapshot: 5000snapshot_prefix: "/opt/caffe-master/examples/mnist/lenet" //这是训练权值的保存路径# solver mode: CPU or GPUsolver_mode: CPU //选择CPU模式另外,模型文件 lenet_train_test.prototxt 里面使用的Lmdb 的路径也要改为绝对路径,不然读取不了数据,如下:
之后在codeblock中 Project->set program's argument 设置命令行参数,argv[0]不用填了,我的如下:
五、运行
可以看到程序运行起来了,但是输出跟在终端的不一样,可能是软件本身的问题,这里直接把输出Read time、Prefetch time、Transform time去掉,即把data_layers里 load_batch函数的输出给注释。
由于修改了源码,需要按照开头的方法重新Make过。这样就不会有输出杂七杂八的time
可以在codeblock打断点单步调试caffe训练过程了。
- codeblock配置caffe
- codeblock配置opencv
- codeblock 环境配置
- CodeBlock 下 配置 多线程!
- CodeBlock的配置方式
- 用codeblock配置FLTK
- codeblock 配置 opencv
- CodeBlock的Winpcap配置
- 用codeblock配置FLTK
- CodeBlock环境下配置wxwidgets
- ubuntu安装和配置codeblock
- codeblock
- codeblock
- Ubuntu下MPI配置以及Codeblock配置
- [Linux] Ubuntu下CodeBlock开发环境配置
- Ubuntu下CodeBlock开发环境配置
- Ubuntu下CodeBlock开发环境配置
- Ubuntu下CodeBlock开发环境配置
- 安装Ubuntu Linux系统时硬盘分区最合理的方法
- ZooKeeper系列(二)
- java学习记录——整数累加及阶乘累加
- AKKA并发编程简介
- 判断一棵二叉树是不是对称的
- codeblock配置caffe
- 利用反射动态调用C#嵌入到资源的托管DLL
- ZooKeeper系列(三)
- Ansible快速入门
- c++实验
- inputStream类型
- openvpn&docker
- 数据结构实验之链表二:逆序建立链表
- 博客-引言