Install CUDA8.0, CUDNN5.0, SSD_caffe

Install OpenCV 2.4.13

  1. sudo apt-get update

  2. sudo apt-get upgrade

  3. sudo apt-get install build-essential libgtk2.0-dev libjpeg-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy python-tk libtbb-dev libeigen2-dev yasm libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libqt4-dev libqt4-opengl-dev sphinx-common texlive-latex-extra libv4l-dev libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev

  4. unzip opencv-2.4.13 -d ./opencv-2.4.13

  5. Do in your opencv folder:

  6. mkdir build

  7. cd build

  8. cmake -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 ..

  9. sudo make

  10. sudo make install

Restart your computer

Install OpenBlas

Download OpenBlas from: http://www.openblas.net/

In your OpenBlas folder, do:

sudo make

sudo make install

cd

sudo apt-get install libopenblas-dev

Install pip

sudo apt-get install python-setuptools python-dev build-essential

sudo easy_install pip

Install Boost

sudo apt-get install libboost-all-dev

Install CUDA

download: https://developer.nvidia.com/cuda-80-ga2-download-archive

Update and install the preliminaries:

sudo apt-get update && sudo apt-get upgrade

sudo apt-get install build-essential

Then update the linux image to be compatible with NVIDIA’s drivers:

sudo apt-get install linux-image-extra-virtual

sudo apt-get install vim

We now need to disable nouveau since it conflicts with NVIDIA’s kernel module:

sudo vi /etc/modprobe.d/blacklist-nouveau.conf

And add the following lines to this file:

blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off

Back in the terminal/shell, execute the commands:

echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf
sudo update-initramfs -u
sudo reboot

After the reboot is complete, we have a few more steps:

sudo apt-get install linux-source
sudo apt-get install linux-headers-$(uname -r)

Now, follow the official website to install CUDA.

Finally, update your path variables. Open your ~/.bashrc file and add the following lines:

export PATH=/usr/local/cuda/bin:$HOME/bin:$PATH

export LD_LIBRARY_PATH=/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/opt/OpenBLAS/lib:$LD_LIBRARY_PATH

export CUDA_HOME=/usr/local/cuda

Remember to run source ~/.bashrc after saving .bashrc and run ldconfig as root ($ sudo ldconfig):

sudo source ~/.bashrc

sudo ldconfig

/sbin/ldconfig.real: /usr/lib/nvidia-384/libEGL.so.1 is not a symbolic link

/sbin/ldconfig.real: /usr/lib32/nvidia-384/libEGL.so.1 is not a symbolic link

sudo mv /usr/lib/nvidia-384/libEGL.so.1 /usr/lib/nvidia-384/libEGL.so.1.org
sudo mv /usr/lib32/nvidia-384/libEGL.so.1 /usr/lib32/nvidia-384/libEGL.so.1.org
sudo ln -s /usr/lib/nvidia-384/libEGL.so.384.90 /usr/lib/nvidia-384/libEGL.so.1
sudo ln -s /usr/lib32/nvidia-384/libEGL.so.384.90 /usr/lib32/nvidia-384/libEGL.so.1
sudo ldconfig

Install cuDNN

download from nvidia

tar -zxf cudnn-8.0-linux-x64-v5.1.tgz

cd cuda

sudo cp lib64/* /usr/local/cuda/lib64/

sudo cp include/cudnn.h /usr/local/cuda/include/

Install SSD_caffe

Install the dependencies:

sudo apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev protobuf-compiler gfortran libjpeg62 libfreeimage-dev libatlas-base-dev git python-dev python-pip libgoogle-glog-dev libbz2-dev libxml2-dev libxslt-dev libffi-dev libssl-dev libgflags-dev liblmdb-dev python-yaml python-numpy

sudo easy_install pillow

sudo apt-get install pypy-dev

Install caffe:

git clone https://github.com/weiliu89/caffe.git

cd caffe

git checkout ssd

cat python/requirements.txt | xargs -L 1 sudo pip install

git checkout ssd

cd

cd /usr/lib/x86_64-linux-gnu

sudo ln -s libhdf5_serial.so.8.0.2 libhdf5.so

sudo ln -s libhdf5_serial_hl.so.8.0.2 libhdf5_hl.so

In MakeFile.config:

Uncomment the line: USE_CUDNN := 1
Make sure the CUDA_DIR correctly points to our CUDA installation.

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/hdf5/serial/

Build caffe

sudo make -j8

sudo make py

sudo make test -j8

sudo make runtest -j8

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s