Deep Learning notes ------ configure and install caffe-cpu only mode in linux, and install caffecpuonly
This article is suitable for beginners to learn the simplest way to configure caffe. This is the most silly configuration method I have summarized after reading the methods of various great gods on the Internet.
I am also suffering from attacks and growth in the Process of constantly configuring caffe @. @
Step 1: configure the dependent environment required by caffe
Open the terminal.
Sudo apt-get install git libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
Sudo apt-get install -- no-install-recommends libboost-all-dev libatlas-base-dev python-dev libgflags-dev libgoogle-glog-dev liblmdb-dev
Step 2: Upgrade gcc and g ++ to 4.9
This step is mainly to prepare for configuring cuda, but it is best to update it.
Sudo add-apt-repository ppa: ubuntu-toolchain-r/test
Sudo apt-get update
Sudo apt-get install gcc-4.9
Sudo apt-get install g ++-4.9
Sudo su
Cd ../usr/bin
Ln-s/usr/bin/g ++-4.9/usr/bin/g ++-f
Ln-s/usr/bin/gcc-4.9/usr/bin/gcc-f
Later, the gcc and g ++ versions are 4.9 by default, and can be queried through gcc -- version.
Step 3: Compile caffe
Download caffe source code on github, web site https://github.com/BVLC/caffe
Download the package and extract it to the main folder directory.
Cd caffe
Cp Makefile. config. example Makefile. config
Open Makefile. config and modify CPU_ONLY = 1. Delete the # sign.
Save and exit.
Make-j8 # (number of CPU threads you call after j)
Make test
Make runtest
If no error is reported, the playing is successful.
Step 4. Install anaconda and configure the python Interface
The official anaconda website provides free and installation instructions, which are easy to use. Https://www.continuum.io/downloads
Change environment variables.
Sudo gedit/etc/profile
Export PATH =/home/irondroid/anaconda2/bin: $ PATH
Export PYTHONPATH =/home/irondroid/caffe/python: $ PYTHONPATH
Export ld_pre load =/usr/lib/x86_64-linux-gnu/libstdc ++. so.6
Source/etc/profile
Cd caffe
Make pycaffe
Step 5. Complete caffe Installation
After restarting the computer, enter python. If the anaconda path appears, it indicates that anaconda is successfully installed. Then
>>> Import caffe
If any errors such as protobuf occur
Sudo chmod 777-R anaconda2
Conda install protobuf
In this way, you can
Then
>>> Import caffe
>>>
Verify that the installation is successful.
Step 6. recompile caffe
If caffe needs to be re-compiled in a new situation, compilation may fail after make clean. In most cases
Cannot find # include "caffe/proto/caffe. pb. h" #1761
If the above error occurs, you need to perform the following steps:
Cd caffe
Protoc src/caffe/proto/caffe. proto -- cpp_out =.
Mkdir include/caffe/proto
Mv src/caffe/proto/caffe. pb. h include/caffe/proto
And then make.
Step 7: Configure cuda and cudnn
I haven't configured the table successfully yet. Read the Table @*@