- ubuntu16.04
- caffe(http://caffe.berkeleyvision.org/)
- cuda8.0
- opencv249(https://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.4.9/opencv-2.4.9.exe/download)
- python-caffe依赖包
Caffe依赖库安装
sudo apt-get install build-essential python-pip
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler libatlas-base-dev libhdf5-dev gfortran libopenblas-dev liblapack-dev libatlas-base-dev llvm-3.8
# 终端输入
sudo ln -s /usr/bin/llvm-config-3.8 /usr/bin/llvm-config
sudo gedit /etc/profile
# 添加并保存
export LLVM_CONFIG=/usr/bin/llvm-config
#
source /etc/profile
Opencv249安装(确保在cuda前安装)
– 安装opencv依赖项
sudo apt-get -y install libopencv-dev
sudo apt-get -y install build-essential checkinstall cmake pkg-config yasm
sudo apt-get -y install libtiff4-dev libjpeg-dev libjasper-dev
sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev
sudo apt-get -y install python-dev python-numpy
sudo apt-get -y install libtbb-dev
sudo apt-get -y install libqt4-dev libgtk2.0-dev
sudo apt-get -y install libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev
sudo apt-get -y install x264 v4l-utils ffmpeg
–@H_301_46@编译&安装
# 解压准备好的opencv2.4.9的源码
cd opencv-2.4.9
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_TIFF=ON -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
# 编译
make -j8
# 安装
sudo make isntall
# 配置环境
sudo gedit /etc/profile
# 在最后添加并保存
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
# 立即生效
source /etc/profile
# 配置lib 路径并保存
sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
# 终端输入
sudo ldconfig
Cuda8.0 安装
# 屏蔽自带驱动
sudo gedit /etc/modprobe.d/blacklist.conf
blacklist nouveau # 最后添加
# 屏蔽图形界面,进入纯文本界面sudo gedit /etc/default/grub
# 屏蔽
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
# 添加
GRUB_CMDLINE_LINUX_DEFAULT="text"
# 终端输入
sudo update-grub
# 重启计算机,进入纯命令界面,进到cuda所在目录
# 更改cuda访问权限
sudo chmod 777 cuda_8.0.44_linux_14.04.run
# 安装cuda
sudo ./cuda_8.0.44_linux_14.04.run # 除了默认选择是no的其余全部yes
# 完成cuda安装,恢复图像界面
sudo vi /etc/default/grub
# 屏蔽
GRUB_CMDLINE_LINUX_DEFAULT="text"
# 打开
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
# 终端输入,并重启
sudo update-grub
# PS:vi操作方法:在移动光标模式下,输入i,进入编辑模式,输入x,删除当前项。在编辑模
#式,按下esc,进入移动光标模式。在移动光标模式下,输入:wq,保存并退出,输入:q!,不保存
#退出。其他操作方法请自行查询。
# 配置cuda环境
sudo gedit /etc/profile
export PATH=/usr/local/cuda/bin:$PATH
source /etc/profile
# lib库
sudo sh -c 'echo "/usr/local/cuda/lib64" > /etc/ld.so.conf.d/cuda.conf'
sudo ldconfig
# 终端输入nvidia-smi,查看是否有显卡信息。输入nvcc --version,查看是否有cuda信息