标签:arc 包括 cep path sample 项目 figure ibm 框架
因为有项目想采用深度学习,而caffe是深度学习框架中比较理想的一款,并且跨平台,以及可以采用python/matlab的方式进行调用等优势,所以想在服务器上安装,下面就开始了血泪史。。。
服务器是阿里云的centos7.3,安装caffe,需要安装ffmpeg,boost,opencv等等。本文依照ffmpeg3.3.2 版,boost为1.64版,opencv为2.4.13.2,caffe的版本为最新版为例来说。
本文主要采用自行编译安装各大软件。
首先安装一些依赖包
1 yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel SDL* yasm* python-devel nasm* cmake* git ncurses* *freetype2
*需要提一下,如果将来要采用python调用caffe的话,必须将numpy提前装好,最新的版本为1.13.2, ipython安装5.0版本(python2.7下)
安装Numpy 1.13.2 以及ipython
1 pip install numpy 2 pip install pandas 3 pip install ipython==5.0
ok,装好就可以往下继续安装其他的的包了,先安装ffmpeg
1、安装x264编码器
因为最新版的x264进行编译的时候要求asm的版本较高,此处分享链接
1 mkdir build 2 cd build 3 wget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20120718-2245-stable.tar.bz2 4 tar -jxf x264-snapshot-20120718-2245-stable.tar.bz25 cd x264-snapshot-20120718-2245-stable/ 6 ./configure --prefix="/usr/local/ffmpeg" --bindir="/usr/local/ffmpeg/bin" --enable-static --enable-shared --enable-pic 7 make 8 make install
2、安装x265编码器
1 cd build 2 git clone https://github.com/videolan/x265.git 3 cd x265/build/linux 4 cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/usr/local/ffmpeg/" -DENABLE_SHARED:bool=off ../../source 5 make 6 make install
3、安装libfdk_acc
1 git clone --depth 1 git://git.code.sf.net/p/opencore-amr/fdk-aac 2 cd fdk-aac 3 autoreconf -fiv 4 ./configure --prefix="/usr/local/ffmpeg" --enable-shared --enable-static --with-pic5 make 6 make install
4、安装libmp3lame
1 wget http://iweb.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz 2 tar zxf lame-3.99.5.tar.gz 3 cd lame-3.99.5 4 ./configure --prefix="/usr/local/ffmpeg" --bindir="/usr/local/bin" --enable-shared --enable-nasm --enable-static --with-pic 5 make 6 make install
5、安装libopus
1 git clone git://git.opus-codec.org/opus.git 2 cd opus 3 ./configure --prefix="/usr/local/ffmpeg" --enable-shared --enable-static --with-pic 4 make 5 make install
6、安装libogg库
1 curl -O http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz 2 tar xzvf libogg-1.3.2.tar.gz 3 cd libogg-1.3.2 4 ./configure --prefix="/usr/local/ffmpeg" --enable-shared --enable-static --with-pic 5 make 6 make install
7、安装libvorbis库
1 curl -O http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz 2 tar xzvf libvorbis-1.3.4.tar.gz 3 cd libvorbis-1.3.4 4 LDFLAGS="-L/usr/local/ffmpeg/lib" 5 CPPFLAGS="-I/usr/local/ffmpeg/include" 6 ./configure --prefix="/usr/local/ffmpeg" --with-ogg="/usr/local/ffmpeg" --enable-shared --enable-static --with-pic 7 make 8 make install
8、安装libvps库
1 git clone --depth 1 http://git.chromium.org/webm/libvpx.git 2 cd libvpx 3 ./configure --prefix="/usr/local/ffmpeg" --enable-examples --enable-shared --enable-static --enable-pic 4 make 5 make install
9、编译安装ffmpeg
此处我才用的是2.8.12的代码,需要编辑ffplay.c,加上头文件<SDL/SDL_version.h>
修改 /etc/ld.so.conf 添加/usr/local/ffmpeg/lib
1 git clone --depth 1 git://source.ffmpeg.org/ffmpeg 2 cd ffmpeg 3 export PKG_CONFIG_PATH=/usr/local/ffmpeg/lib/pkgconfig/:/usr/lib64/pkgconfig/:/usr/share/pkgconfig/$PKG_CONFIG_PATH 4 ./configure --prefix="/usr/local/ffmpeg" --extra-cflags="-I/usr/local/ffmpeg/include" --extra-ldflags="-L/usr/local/ffmpeg/lib" --bindir="/usr/local/bin" --pkg-config-flags="--static" --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-avresample --enable-pic --enable-static --enable-shared 5 make 6 make install
10、编译安装boost
1 wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.gz 2 tar -zxf boost_1_64_0.tar.gz 3 cd boost_1_64_0 4 ./boostrap.sh 5 ./b2 install
11、再次安装一些依赖包
1 yum install a52dec* giflib* imlib* lame* libICE* libXdmcp* *dc1394* *raw1394* *avc1394* *raw1394* 2 yum groupinstall "Development Tools" 3 yum install openssl* sqlite* gtk* *java* gstreamer* *v4l* gmp* gimp* *java* libpng*
12、安装opencv2.4.13.2
1 ln -s /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h 2 echo "/usr/local/ffmpeg/lib" >> /etc/ld.so.conf 3 ldconfig 4 export C_INCLUDE_PATH=/usr/local/ffmpeg/include/:/usr/include/:$C_INCLUDE_PATH 5 export CPLUS_INCLUDE_PATH=/usr/local/ffmpeg/include/:/usr/include/:$CPLUS_INCLUDE_PATH 6 export LD_LIBRARY_PATH=/usr/local/ffmpeg/lib/:/usr/loca/lib/:/usr/lib/:$LD_LIBRARY_PATH 7 wget https://github.com/opencv/opencv/archive/2.4.13.2.zip 8 unzip 2.4.13.2.zip 9 cd opencv-2.4.13.2/ 10 mkdir build 11 cmake –D CMAKE_BUILD_TYPE=RELEASE–D CMAKE_INSTALL_PREFIX=./build/ ../opencv-2.4.13.2 12 make 13 make install
13、再次安装依赖包
1 yum install protobuf* leveldb* snappy* hdf5* lmdb* libunwind* 2 wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/google-glog/glog-0.3.3.tar.gz 3 tar -zxf glog-0.3.3.tar.gz 4 cd glog-0.3.3/ 5 ./configure --enable-static --enable-shared --with-pic 6 make 7 make install 8 wget https://github.com/schuhschuh/gflags/archive/master.zip 9 unzip master.zip 10 cd gflags-master/ 11 mkdir build && cd build 12 export CXXFLAGS="-fPIC" && cmake .. && make VERBOSE=1 13 make
14、安装BLAS,CBLAS,OpenBLAS
1 wget http://www.netlib.org/blas/blas-3.7.1.tgz 2 tar -zxf blas-3.7.1.tgz 3 cd BLAS-3.7.1/ 4 gfortran -c -O3 *.f 5 ar rv libblas.a *.o 6 wget http://www.netlib.org/blas/blast-forum/cblas.tgz 7 tar -zxf cblas.tgz 8 cd CBLAS/ 9 cp Makefile.LINUX Makefile.in 10 cp ../BLAS-3.7.1/libblas.a testing/ 11 cp lib/cblas_LINUX.a /usr/local/lib/libcblas.a 12 cp testing/libblas.a /usr/local/lib/libblas.a 13 cp include/cblas.h /usr/local/include/ 14 wget http://github.com/xianyi/OpenBLAS/archive/v0.2.19.tar.gz 15 tar -zxf v0.2.19.tar.gz 16 cd OpenBLAS-0.2.19/ 17 make 18 make PREFIX=/usr/local install 19 git clone https://github.com/BVLC/caffe.git 20 cd caffe 21 cp Makefile.config.example Makefile.config
15、编辑Makefile.config
8 CPU_ONLY := 1 28 # CUDA_DIR := /usr/local/cuda 29 # On Ubuntu 14.04, if cuda tools are installed via 30 # "sudo apt-get install nvidia-cuda-toolkit" then use this instead: 31 # CUDA_DIR := /usr 32 33 # CUDA architecture setting: going with all of them. 34 # For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility. 35 # For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility. 36 #CUDA_ARCH := -gencode arch=compute_20,code=sm_20 37 # -gencode arch=compute_20,code=sm_21 38 # -gencode arch=compute_30,code=sm_30 39 # -gencode arch=compute_35,code=sm_35 40 # -gencode arch=compute_50,code=sm_50 41 # -gencode arch=compute_52,code=sm_52 42 # -gencode arch=compute_60,code=sm_60 43 # -gencode arch=compute_61,code=sm_61 44 # -gencode arch=compute_61,code=compute_61 50 BLAS := open 51 # Custom (MKL/ATLAS/OpenBLAS) include and lib directories. 52 # Leave commented to accept the defaults for your choice of BLAS 53 # (which should work)! 54 BLAS_INCLUDE := /usr/local/include 55 BLAS_LIB := /usr/local/lib
16、安装caffe
1 cd python 2 for req in $(cat requirements.txt); do pip install $req; done 3 cd .. 4 make all 5 make test 6 make runtest 7 make pycaffe 8 cp -r python/caffe/ /usr/lib64/python2.7/site-packages/ 9 echo "/root/build/caffe/.build_release/lib" >> /etc/ld.so.conf 10 pip uninstall numpy 11 wget https://pypi.python.org/packages/1a/5c/57c6920bf4a1b1c11645b625e5483d778cedb3823ba21a017112730f0a12/numpy-1.11.0.tar.gz#md5=bc56fb9fc2895aa4961802ffbdb31d0b 12 tar -zxf numpy-1.11.0.tar.gz 13 cd numpy-1.11.0 14 python setup.py build 15 python setup.py install
CentOS7下安装caffe(包括ffmpeg\boost\opencv)
标签:arc 包括 cep path sample 项目 figure ibm 框架
原文地址:http://www.cnblogs.com/sumoning/p/7126386.html