Ubuntu16.04 Caffe Installation record1. Install the video driver
First update the input:
sudo apt-get updatesudo apt-get upgrade
Then open system settings in Software&updates
Select the following and click Apply Changes.
2. Disable Nouveau
Edit File
sudo gedit/etc/modprobe.d/blacklist-nouveau.conf
Write in an open file:
Blacklist nouveau option Nouveau modeset=0
Perform
sudo update-initramfs-u
Restart, enter
Reboot
3. Installing dependent Packages
Enter in turn:
sudo apt-get install Libprotobuf-dev libleveldb-dev libsnappy-dev Libopencv-dev Libhdf5-serial-dev Protobuf-compilersudo apt-get Install--no-install-recommends libboost-all-devsudo apt-get Install Libopenblas-dev Liblapack-dev libatlas-base-devsudo apt-get Install libgflags-dev libgoogle-glog-dev liblmdb-devsudo apt-get Install Git cmake build-essential
4. Configure Environment variables
To open a configuration file:
sudo gedit ~/.BASHRC
Add to:
Save exit
5. Installing Cuda 8.0
Execute executable file:
sudo sh cuda_8.0.61_375.26_linux.run--no-opengl-libs
Note: Do not choose to install the video driver during the installation process, and select Yes.
Restart:
Reboot
To open a configuration file:
sudo gedit ~/.BASHRC
To add an environment variable:
Export Path=/usr/local/cuda-8.0/bin: $PATHexport ld_library_path=/usr/local/cuda/lib64: $LD _library_path
To make the configuration effective:
SOURCE ~/.BASHRC
6. Validate Cuda 8.0
Cd/usr/local/cuda-8.0/samples/1_utilities/devicequerysudo Make./devicequery
7. Installing CUDNN
Download the CUDNN and copy it to the/usr/local path:
sudo cp/home/peiyuyang/cudnn-8.0-linux-x64-v6.0.tgz/usr/local
Unzip, perform:
sudo tar-zxvf cudnn-8.0-linux-x64-v6.0.tgz
After decompression, execute:
sudo cp cuda/include/cudnn.h/usr/local/cuda/include/sudo CP cuda/lib64/libcudnn*/usr/local/cuda/lib64/sudo chmod a+r /usr/local/cuda/include/cudnn.hsudo chmod a+r/usr/local/cuda/lib64/libcudnn*
8. Script Installationopencv-3.3. 0
To install Git:
sudo apt install git
Download:
git clone Https://github.com/jayrambhia/Install-OpenCV
Open path:
CD install-opencv/ubuntu/
Assigning permissions:
chmod +x *
For insurance purposes:
sudo apt-get update
To run the script:
./opencv_latest.sh
A long time, the final appearance of OpenCV-3.3.0 ready to be used, the installation was successful.
9. Installing Caffe
Under Installation path:
git clone https://github.com/BVLC/caffe.git
Change all file permissions in the user directory to the permissions of the current user:
Chown-r Uer.uer/home/user
Enter Caffe path, copy Makefile.config.example:
sudo cp Makefile.config.example Makefile.config
To modify the Makefile.config file:
sudo gedit makefile.config
Modify:
Change #use_cudnn: = 1 to: use_cudnn: = 1 will #opencv_version: = 3 modified to: opencv_version: = 3 will #with_python_layer: = 1 modified to With_python_ LAYER: = 1
Include_dirs: = $ (python_include)/usr/local/includelibrary_dirs: = $ (python_lib)/usr/local/lib/usr/lib modified to: INCLUDE _dirs: = $ (python_include)/usr/local/include/usr/include/hdf5/seriallibrary_dirs: = $ (python_lib)/usr/local/lib/ Usr/lib/usr/lib/x86_64-linux-gnu/usr/lib/x86_64-linux-gnu/hdf5/serial
To modify the Makefile file:
Gedit Makefile
Modify:
Modify Nvccflags +=-ccbin=$ (CXX)-xcompiler-fpic $ (common_flags) to: Nvccflags + =-d_force_inlines-ccbin=$ (CXX)-Xcompiler- FPIC $ (common_flags) will LIBRARIES + = Glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5 modified to: LIBRARIES + = Glog g Flags Protobuf boost_system boost_filesystem m HDF5_SERIAL_HL hdf5_serial
To modify the Host_config.h file:
Modify:
The #error--unsupported GNU version! GCC versions later than 4.9 is not supported! changed to//#error--Unsupported GNU version! GCC versions later than 4.9 is not supported!
Start compiling Caffe:
Make All-j8
Run Test after successful compilation:
sudo make runtest-j8
10. Compiling Pycaffe
Installation dependencies:
sudo apt-get install-y python-numpy python-scipy python-matplotlib python-sklearn python-skimage python-h5py Python-protobuf python-leveldb python-networkx python-nose python-pandas python-gflags Cython Ipython
Compile:
Make Pycaffe-j8
After success seems not to Python,import Caffe. Proceed to the next step first.
11. Installing Anaconda
After the installation decompression, enter the decompression directory, run:
Bash anaconda2-4.4.0-linux-x86_64.sh
Select Add environment variable.
Make environment variables effective
SOURCE ~/.BASHRC
Then proceed as follows:
sudo pip install easydict
Pip install protobufsudo apt-get install Python-protobufconda install LIBGCC
Then you can import caffe smoothly.
Ubuntu16.04 Caffe Installation Record