Created
June 2, 2017 09:56
-
-
Save shridharkini6/dbffef72d3b0d728b020cbe582a5a6dd to your computer and use it in GitHub Desktop.
Opencv 3.2.0(with opencv_contrib 3.2.0) + Caffe(CPU only installation)( no virtual environment)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#read and understand installation procedure | |
#do suitable modification to Makefile.config for caffe | |
#CPU only installation | |
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse" | |
sudo apt-get update | |
sudo apt-get -y install build-essential cmake libtbb-dev git curl python-pycurl | |
sudo apt-get -y install libboost-python-dev | |
sudo apt-get -y install python-pip gstreamer1.0-libav libavresample-dev libgphoto2-dev qt5-default libdc1394-22 libdc1394-22-dev | |
sudo apt-get -y install libatlas-base-dev gfortran libopenblas-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev | |
sudo apt-get -y install libblas-dev liblapack-dev | |
sudo apt-get -y install python-matplotlib python-scipy python-numpy libtheora-dev libvorbis-dev | |
sudo apt-get -y install libffi6 libffi-dev liblapacke-dev | |
sudo apt-get -y install libgtk2.0-dev pkg-config python-dev libjpeg-dev libpng12-dev libtiff5-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libqt4-dev libfaac-dev x264 v4l-utils unzip libgtk-3-dev libgtkglextmm-x11-1.2-dev libeigen3-dev libav-tools libhdf5-dev | |
sudo apt-get -y install python-skimage libgflags-dev libgoogle-glog-dev libxine2-dev libgstreamer-plugins-base1.0-dev | |
sudo pip install numpy scipy | |
sudo pip install pycurl | |
sudo pip install scikit-image | |
sudo pip install pillow | |
sudo pip install PyYAML | |
sudo pip install requests | |
sudo pip install h5py | |
sudo apt-get install libv4l-dev | |
cd /usr/include/linux/ | |
sudo ln -s ../libv4l1-videodev.h videodev.h | |
git clone https://github.com/Itseez/opencv_contrib.git | |
cd opencv_contrib | |
git checkout 3.2.0 | |
cd .. | |
git clone https://github.com/Itseez/opencv.git | |
cd opencv | |
git checkout 3.2.0 | |
mkdir build | |
cd build | |
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_OPENGL=ON -D OPENCV_EXTRA_MODULES_PATH=$HOME/Downloads/opencv_contrib/modules -D WITH_IPP=OFF WITH_EIGEN=ON .. #IPP is a paid one | |
make -j4 #number 4 depends on cores... | |
sudo make install | |
sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf' | |
sudo ldconfig | |
#ln -s /usr/local/lib/python2.7/dist-packages/cv2.so -t $HOME/.virtualenvs/test1/lib/python2.7/ #this depends on where cv2.so installed | |
cd $HOME/Downloads | |
#caffe installations | |
sudo apt-get install -y opencl-headers build-essential protobuf-compiler \ | |
libprotoc-dev libboost-all-dev libleveldb-dev hdf5-tools libhdf5-serial-dev \ | |
libopencv-core-dev libopencv-highgui-dev libsnappy-dev \ | |
libatlas-base-dev cmake libstdc++6-4.8-dbg libgoogle-glog0v5 libgoogle-glog-dev \ | |
libgflags-dev liblmdb-dev git python-pip gfortran libopencv-dev | |
# Get caffe, and install python requirements | |
git clone https://github.com/BVLC/caffe.git | |
cd caffe | |
cd python | |
for req in $(cat requirements.txt); do sudo pip install $req; done | |
cd ../ | |
cp Makefile.config.example Makefile.config | |
#make changes to your Makefile.config, dont forget to add /usr/include/hdf5/serial/ to INCLUDE_DIRS | |
sudo ln -s /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.10.1.0 /usr/lib/x86_64-linux-gnu/libhdf5.so | |
sudo ln -s /usr/lib/x86_64-linux-gnu/libhdf5_serial_hl.so.10.0.2 /usr/lib/x86_64-linux-gnu/libhdf5_hl.so | |
sudo make all -j8 | |
sudo make test | |
sudo make runtest | |
sudo make pycaffe | |
sudo make distribute | |
echo "export PYTHONPATH=$HOME/Downloads/caffe/python:$PYTHONPATH" >> ~/.bashrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment