Objective:
Body:
1. Install the necessary dependent packages:
sudo Install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-Compiler sudoinstall --no-install-recommends libboost-all-devsudo Install libatlas-base-devsudoinstall python-devsudo Install Libgflags-dev libgoogle-glog-dev Liblmdb-dev
Python requires version 2.7, which is already installed by the operating system itself. The input python2.7--version will display the specific version number instructions installed.
1. Download Caffe:
First install the Git tool:
sudo Install git
Then download the Caffe package:
git clone https://github.com/bvlc/caffe.git
Next go to the Caffe directory (I said Caffe downloaded to/home).
CD caffe/
Go to the Python folder inside and enter
for in $ (catdoesinstall done
If you don't have a pip, install it first: sudo apt install python-pip
2, installation Caffe
Enter the Caffe root directory and use the template to write a makefile.config. The specific is to copy the template first, and then change some content
CP Makefile.config.example Makefile.config
First, #CPU mode, in the cpu_only: = 1 before the # to be removed. (Because running Caffe only under the CPU)
Then, in which to find the following, two paths to change to this: (Add the following two hdf5 path, otherwise compile times HDF5 error)
# Whatever Else you find your need goes here.
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
Now you're ready to start installing Caffe:
Execute the following command in turn:
Make Pycaffe Make All Make Test make Runtest
When I executed the Make pycaffe command, I made a mistake: fatal error:numpy/arrayobject.h didn't have that file or directory
In fact, NumPy is already installed, anaconda2 inside, Python import numpy also no problem, but is here error, solution:
sudo Install Python-numpy
然后再执行一遍 make pycaffe命令就行了。
Show all tests PASSED, instructions already installed
3, Training mnist set
Locating the terminal to the Caffe root directory
Then execute the script file, download the Mnist database, and unzip
./data/mnist/get_mnist. SH
I do not receive HTTP due to network problems, so according to the code in the script, according to the Web site to download the compressed package, CP to the Mnist folder, using the decompression commands in the script to extract.
Then, convert it to the LMDB database format
./examples/mnist/create_mnist. SH
Then train the network
./examples/mnist/train_lenet. SH
When you are training, you can see the loss and accuracy values
You can see that the final training accuracy is 0.9911.
Completed successfully.
Share only for Better records ~
by Still,
Caffe Learning Series (i) Ubuntu16.04 build Caffe environment and run mnist example (CPU only)