Caffe(1)-安装

Caffe安装

@[Deep Learning]
系统环境ubuntu14.04

1. 依赖
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
2.CUDA 这里不作详细结束,详见CUDA官网
3. BLAS 根据自己需要选择安装ATLAS、OpenBlas、MKL等,我这里用的是ATLAS
4. python

安装一些python依赖库

cd caffe/python
for req in $(cat requirements.txt); do pip install $req; done
5.cuDNN我的显卡不支持,这里没有安装
6.opencv 详见opencv安装向导
7.编译

(1) 使用make

cd caffe
cp Makefile.config.example Makefile.config
# Adjust Makefile.config (for example, if using Anaconda Python, or if cuDNN is desired)
make all -j2
make test
make runtest

这里遇到了一些错误

CXX/LD -o .build_release/tools/convert_imageset.bin
.build_release/lib/libcaffe.so: undefined reference to cv::imread(cv::String const&, int)' .build_release/lib/libcaffe.so: undefined reference tocv::imencode(cv::String const&, cv::_InputArray const&, std::vector >&, std::vector > const&)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
collect2: error: ld returned 1 exit status
make: *** [.build_release/tools/convert_imageset.bin] Error 1

解决办法:
第一种:

gedit Makefile

找到

LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5

改为

LIBRARIES += glog gflags protobuf leveldb snappy \
lmdb boost_system hdf5_hl hdf5 m \
opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs

第二种:
使用(2)
(2) 使用cmake

mkdir build
cd build
cmake ..
make all -j2
make install
make runtest
  1. 使用pycaffe
make pycaffe

设置环境变量

gedit ~/.bashrc

在文件末尾添加

export PYTHONPATH=/path/to/caffe/python:$PYTHONPATH

然后关闭并保存文件,执行以下语句

source ~/.bashrc

好了,这里pycaffe就配置好了
可以进入python shell执行

import caffe

如果没有错误说明安装成功了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值