先下载opencv软件包
依赖项
sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
or
sudo apt-get install python-dev
sudo apt-get install python-numpy
sudo apt-get install libtbb2
sudo apt-get install libtbb-dev
sudo apt-get install libjpeg-dev
sudo apt-get install libpng-dev
sudo apt-get install libtiff-dev
sudo apt-get install libjasper-dev
sudo apt-get install libdc1394-22-dev
mkdir build #新建一个build文件夹,编译的工程都在这个文件夹里
cd build/
cmake -D CMAKE_BUILD_TYPE=RELEASE -DENABLE_PRECOMPILED_HEADERS=OFF -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=OFF -D WITH_OPENGL=ON -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES" ..
cmake成功后,会出现如下结果,提示配置和生成成功:
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ise/software/opencv-3.1.0/build
gpu版本 opencv-3.0.0/modules/cudalegacy/src/graphcuts.cpp
在graphcuts.cpp中将
#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER)
改为
#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) || (CUDART_VERSION >= 8000)
然后make编译就可以了
make -j8
上面是将opencv编译成功,但是并没有安装到我们的系统中,有很多的设置都没有写入到系统中,因此还要进行install。
sudo make install
sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig
caffe安装
终于开始caffe安装了。首先安装各种依赖包。
sudo apt-get update
sudo apt-get install -y build-essential cmake git pkg-config
sudo apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install -y libatlas-base-dev
sudo apt-get install -y libboost-all-dev
sudo apt-get install -y libgflags-dev libgoogle-glog-dev liblmdb-dev
sudo apt-get install -y python-pip
sudo apt-get install -y python-dev
sudo apt-get install -y python-numpy python-scipy
将终端cd到你要安装caffe的位置,执行如下指令,从github上clone caffe。
git clone https://github.com/BVLC/caffe.git //从github上git caffe
cd caffe
sudo cp Makefile.config.example Makefile.config //将Makefile.config.example的内容复制到Makefile.config
//因为make指令只能make Makefile.config文件,而Makefile.config.example是caffe给出的makefile例子
sudo gedit Makefile.config //打开Makefile.config文件
打开之后修改如下内容:
//若使用cudnn,则将# USE_CUDNN := 1 修改成: USE_CUDNN := 1
//若使用的opencv版本是3的,则将# OPENCV_VERSION := 3 修改为: OPENCV_VERSION := 3
//若要使用python来编写layer,则需要将# WITH_PYTHON_LAYER := 1 修改为 WITH_PYTHON_LAYER := 1
//重要的一项 将# Whatever else you find you need goes here.下面的 INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib
修改为: 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 /usr/lib/x86_64-linux-gnu/hdf5/serial //这是因为ubuntu16.04的文件包含位置发生了变化,尤其是需要用到的hdf5的位置,所以需要更改这一路径
打开makefile文件:
将
NVCCFLAGS +=-ccbin=$(CXX) -Xcompiler-fPIC $(COMMON_FLAGS)
替换
NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)
make all -j8
make runtest
安装anaconda2
bash Anaconda2-5.0.1-Linux-x86_64.sh
sudo vim ~/.bashrc
- # add library path
- LD_LIBRARY_PATH=your_anaconda_path/lib:$LD_LIBRARY_PATH
- export LD_LIBRARY_PATH
sudo apt-get install python-dev python-pip
cd到caffe-master/python目录下,执行
for req in $(cat requirements.txt); do sudo pip install $req; done
cd到caffe-master目录下,编译执行
sudo make pycaffe
(必须)
sudo chmod 777 -R anaconda2
conda install protobuf
完毕
(转)http://blog.csdn.net/zoro_lov3/article/details/60581174
安装matlab_caffe
编译
(1)安装matlab
http://blog.csdn.net/generallc/article/details/52793820
(2)修改Makefile.config 在caffe-master目录下
![](https://images2018.cnblogs.com/blog/1189465/201803/1189465-20180310224618063-496639767.png)
参考:https://www.cnblogs.com/haoliuhust/p/7738920.html
fsater-rcnn:http://blog.csdn.net/zyb19931130/article/details/53842791