美文网首页
Ubuntu18.04/16.04 安装caffe - 2020

Ubuntu18.04/16.04 安装caffe - 2020

作者: 太极侠岚 | 来源:发表于2020-06-23 10:32 被阅读0次

1.安装依赖

sudo apt-get install libprotobuf-dev
sudo apt-get install libleveldb-dev
sudo apt-get install libsnappy-dev
sudo apt-get install libopencv-dev
sudo apt-get install libhdf5-serial-dev
sudo apt-get install protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libopenblas-dev liblapack-dev libatlas-base-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
sudo apt-get install git cmake build-essential

2.下载caffe

git clone https://github.com/BVLC/caffe.git

3.进入caffe

cd /home/caffe
复制Makefile.config
cp Makefile.config.example Makefile.config

4.修改配置

vi  Makefile.config
打开
CPU_ONLY := 1
USE_OPENCV :=1
USE_LEVELDB :=1
USE_LMDB :=1
USE_HDF5 :=1
OPENCV_VERSOIN :=3
修改一下内容为下面内容
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial

5.编译

sudo make all -j8
sudo make test -j8
sudo make runtest -j8

6.安装支持

安装
sudo apt-get install python-pip
设置pip国内源
cd /home
mkdir ~/.pip
vi ~/.pip/pip.conf
加入配置
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
安装
sudo apt-get install python-numpy

7.安装caffe依赖库

cd /home/caffe/python
执行
for req in $(cat requirements.txt); do pip install $req; done
执行完成后验证下
sudo pip install -r requirements.txt

8.添加caffe路径

vi ~/.bashrc
最后一行加上
export PYTHONPATH=/home/tong/caffe/python:$PYTHONPATH
保存后让生效
source ~/.bashrc

9.生成pycaffe

cd /home/caffe
执行
sudo make pycaffe -j8

10.打完收工

相关文章

网友评论

      本文标题:Ubuntu18.04/16.04 安装caffe - 2020

      本文链接:https://www.haomeiwen.com/subject/cpscfktx.html