Last active
August 29, 2015 14:02
-
-
Save microhello/971a68efa73066d450df to your computer and use it in GitHub Desktop.
Caffe Install and Config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
一、Caffe安装过程: | |
0、安装Ubuntu 12.04 LTS_x64 虚拟机 | |
1、根据http://caffe.berkeleyvision.org/installation.html此处的安装说明, | |
分别下载caffe-master.zip、cuda_5.5.22_linux_64.run、 l_mkl_online_11.1.0.080.sh; | |
2、安装cuda 5.5 | |
sudo ./cuda_5.5.22_linux_64.run | |
sudo ldconfig /usr/local/cuda/lib64 | |
3、 安装glog: | |
wget https://google-glog.googlecode.com/files/glog-0.3.3.tar.gz | |
tar zxvf glog-0.3.3.tar.gz | |
cd glog-0.3.3/ | |
./configure | |
make & make install | |
ldconfig | |
4、安装MKL: | |
sudo sh l_mkl_online_11.1.0.080.sh | |
sudo ldconfig /opt/intel/mkl/lib/intel64 | |
5、安装boost、opencv、leveldb、protobuf | |
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev | |
6、安装caffe,配置环境变量 | |
cd caffe-master | |
cp Makefile.config.example Makefile.config | |
make | |
make test | |
make runtest | |
export CAFFE_ROOT=/home/zxy/Downloads/caffe-master/ | |
二、Caffe自带lenet训练 | |
1、下载并转换数据集为leveldb格式 | |
cd $CAFFE_ROOT/examples/lenet/ | |
cd $CAFFE_ROOT/data/mnist | |
./get_mnist.sh | |
cd $CAFFE_ROOT/examples/lenet | |
./create_mnist.sh | |
会生成两个文件夹mnist-test-leveldb、mnist-train-leveldb | |
2、使用CPU模式、减少迭代次数 | |
修改 $CAFFE_ROOT/examples/lenet/lenet_solver.prototxt, | |
# The maximum number of iterations | |
max_iter: 2000 | |
# solver mode: 0 for CPU and 1 for GPU | |
solver_mode: 0 | |
3、训练 | |
./train_lenet.sh | |
生成结果文件:lenet_iter_2000 | |
4、测试 | |
编写测试脚本test_lenet.sh,内容为: | |
#!/usr/bin/env sh TOOLS=../../build/tools GLOG_logtostderr=1 $TOOLS/test_net.bin lenet_test.prototxt lenet_iter_2000 2000 CPU | |
运行结果: Test accuracy:0.9859 | |
三、基于Caffe的开发 | |
1、使用Eclipse做为开发工具,Java做为开发语言 | |
2、采用在Java中调用shell命令行(train_lenet.sh,test_lenet.sh)的方式 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment