(一)安装OpenCV3.1(包括opencv_contrib)
必须软件包
yum install -y gcc gcc-c++ gtk+-devel libjpeg-devel libtiff-devel jasper-devel libpng-devel zlib-devel cmake
yum install git gtk2-devel pkgconfig numpy python python-pip python-devel gstreamer-plugins-base-devel libv4l ffmpeg-devel
yum install mplayer mencoder flvtool2
yum install libdc1394
yum install gtk*
解压opencv,然后配置CMakeList文件
将opencv_contrib路径写入OPENCV_EXTRA_MODULES_PATH中
set(OPENCV_EXTRA_MODULES_PATH /root/tools/opencv_contrib-master/modules)
$ mkdir>
$ cd>
$ cmake ..
$ make -j4
$ make install
在 /etc/ld.so.conf.d文件夹下建立opencv.conf,内容是/usr/local/lib
在/etc/profile最后加入下面代码
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
然后记得 source /etc/profile
最最后:记得
sudo ldconfig
(二) 安装OpenBLAS的步骤
下载地址
(2)cd OpenBLAS
(3)make FC=gfortran (如果没有安装gfortran,执行sudo apt-get install gfortran)(centos是yum install gcc-gfortran)
(4)make install (将OpenBLAS安装到/opt下)
(5)执行以下命令完成安装
ln -s /opt/OpenBLAS/lib/libopenblas.so /usr/lib/libblas.so.3
ln -s /opt/OpenBLAS/lib/liblapack.so.3 /usr/lib/liblapack.so.3
在/etc/profile中加入
LD_LIBRARY_PATH=/opt/OpenBLAS/lib
export LD_LIBRARY_PATH
(三) Install Caffe on CentOS 7
July 29, 2015 admin Caffe, Tutorials
原始链接
特别感谢
Caffe is one of the most powerful framework to train deep neural networks. This tutorial will show you how to install Caffe on CentOS 7 step by step.
I suggest you to apply this tutorial on a computer with a new and clean installation of CentOS 7.
Update yum to get last version
sudo yum update
Install gcc compiler:
sudo yum install gcc gcc-c++
Install git, vim, python dev and pip:
sudo yum install git vim python-devel python-pip
Step 2: Install Caffe Dependencies
Install required libraries
sudo yum install protobuf-devel leveldb-devel openblas-devel snappy-devel opencv-devel boost-devel hdf5-devel gflags-devel glog-devel lmdb-devel
注意:如果安装中有些包没找到,先安装 sudo yum install epel-release 然后再尝试,就可以了。
什么是epel?
如果既想获得 RHEL 的高质量、高性能、高可靠性,又需要方便易用(关键是免费)的软件包更新功能,那么 Fedora Project 推出的 EPEL(Extra Packages for Enterprise Linux)正好适合你。EPEL(http://fedoraproject.org/wiki/EPEL) 是由 Fedora 社区打造,为 RHEL 及衍生发行版如 CentOS、Scientific Linux 等提供高质量软件包的项目。
sudo wget http://developer.download.nvidia.com/compute/cuda/repos/rhel6/x86_64/cuda-repo-rhel6-6.5-14.x86_64.rpm
sudo rpm --install cuda-repo-rhel6-6.5-14.x86_64.rpm
sudo yum clean expire-cache
sudo yum install cuda
Step 2b: GPU Support (Optional: ONLY if computer has CUDA compatible GPU)
Note: CUDA only support NVIDIA graphic cards. ATI Radeon GPU can’t be used, you will have to stick with CPU only mode.
Download and Install last NVIDIA Driver for your device
Go to NVIDIA website, download your graphic card last driver and run the driver file to install it
Download and Install CUDNNv3 (You need to register to NVIDIA website to get last version, or just use the mirror provided below)
wget ...
sudo tar -xvf cudnn-7-0.tgz
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/
Git clone Caffe repository
git clone https://github.com/BVLC/caffe
Step 4: Install Python Dependencies
Caffe has a Python interface for easy scripting, I suggest you to install it.
for req in $(cat caffe/python/requirements.txt); do sudo pip install $req; done
Move to Caffe folder and copy/paste Make configuration file
cd caffe
cp Makefile.config.example Makefile.config
Edit Makefile.conf
vim Makefile.config
Edit the line
BLAS := atlas
Change ‘atlas’ to ‘open’
BLAS := open
And add a new line under it:
BLAS_INCLUDE := /usr/include/openblas
Then edit line: (located under “PYTHON_INCLUDE := /usr/include/python2.7 \”)
/usr/lib/python2.7/dist-packages/numpy/core/include
Change python directory to ‘/usr/lib64/python2.7/site-packages/’, the line should then looks like that
/usr/lib64/python2.7/site-packages/numpy/core/include
Then edit according to your device GPU capability:
Without GPU support:
Edit the line
# CPU_ONLY := 1
Remove the number sign “#”. The line will then looks like this:
CPU_ONLY := 1
Save and Close file
— OR —
With GPU support:
# USE_CUDNN := 1
Remove the number sign “#”. The line will then looks like this:
USE_CUDNN := 1
Start to compile Caffe
sudo make all
sudo make runtest
sudo make pycaffe
sudo make distribute
Done!
Now you can start to try Caffe examples and tutorials.
If you have any question, you can leave a comment.
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com