English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
First, let's complain about my laptop, the one I have now is a Dell INSPIRON I bought in my first year of college 4010No Nvidia, no Nvidia, no Nvidia, no Nvidia, say the important things four times, hahaha.
Operating system: Ubuntu 14.04
Whether to use PYTHON API: Yes, the goal is to install CAFFE as a PYTHON MODULE after installation
Hardware: Low-end laptop, only use CPU mode
1. Install dependencies
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler sudo apt-get install --no-install-recommends libboost-all-dev sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev sudo apt-get install libatlas-base-de
PYTHON needs2.7Version, this is the one that has been installed on the operating system itself. Enter python2.7 --version will display the specific version number indicating the installed version.
But you still need sudo apt-get install python-dev
2. Download Caffe
It is very simple to download Caffe directly using Git, or go to https://github.com/BVLC/Caffe download. Since I am accustomed to finding code on github, I directly download the source code.
After the download is complete, you can find caffe in the download folder under the home directory-master.zip, use the unzip command to unzip it to the home directory, and then rename it to caffe.
3.compile Caffe
(1) Switch to the directory where Caffe is located
cp Makefile.config.example Makefile.config
(2) Modify the configuration file Makefile.config
CPU_ONLY := 1
Configure some reference files (the main part of the increase is to solve the HDF under the new version)5path issues)
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/lib/x86_64-linux-gnu/hdf5/serial LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial BLAS := atlas
Computing capability mkl > openlas >atlas
(3compile Caffe
make all make test make runtest
Additionally, this make uses CPU single-core computation by default. If you want to speed up, for example, if I want to use four cores, add-j4label.
If above4If you want to retry after an error occurs in a line, it is recommended to run 'make clean' first and then start over.
4.compile Python interface
Caffe has python\C++shell interface, it is very convenient to use python in Caffe, and there are interface descriptions in the examples.
Ensure that pip is already installed
sudo apt-get install python-pip
Execute installation of dependencies
Under the python folder in the root directory of caffe, there is a requirements.txt list file that lists the required dependent libraries. Install according to this list.
When installing the scipy library, a fortran compiler (gfortran) is required. If this compiler is not available, an error will occur. Therefore, we can install it first.
First, go back to the root directory of caffe, and then execute the installation code:
cd ~/caffe sudo apt-get install gfortran for req in $(cat requirements.txt); do pip install $req; done
After installation is complete, we can execute:
sudo pip install -r python/requirements.txt
You will see, the ones installed successfully will display 'Requirement already satisfied', and the ones not installed successfully will continue to install.
compile python interface
make pycaffe
--The result shows ALL TESTS PASSED, which means it is installed!
Run the python structure
$ python2.7 Python 2.7.12 (default, Jul 1 2016, 15:12:24) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import caffe >>>
If no error is reported, it means that the Caffe installation is complete!
5.Running Lenet in Mnist
Get the data source
./data/mnist/get_mnist.sh ./examples/mnist/create_mnist.sh
Since it is running on CPU, modify the solver_mode:CPU in lenet_solver.prototxt under Mnist in the examples file
solver_mode: CPU
Train the model
./examples/mnist/train_lenet.sh
The entire training time will be very long, because this guy's notebook is still an i3processor, and GPU is not enabled, and it is default single-core, so this guy has been waiting for a long time3hours
The above is what the editor has introduced to everyone about Ubuntu14.04Detailed tutorial on setting up Caffe (only CPU), hoping it will be helpful to everyone. If you have any questions, please leave a message, and the editor will reply to everyone in a timely manner. I am also very grateful for everyone's support for the Yelling Tutorial website!
Statement: The content of this article is from the Internet, and the copyright belongs to the original author. The content is contributed and uploaded by Internet users spontaneously, and this website does not own the copyright. It has not been manually edited and does not assume any relevant legal liability. If you find any copyright-infringing content, please send an email to: notice#oldtoolbag.com (Please replace # with @ when sending an email to report abuse, and provide relevant evidence. Once verified, this site will immediately delete any infringing content.)