In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to install Ubuntu14.04 Caffe. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
Introduction to Caffe
Caffe, whose full name is Convolutional Architecture for Fast Feature Embedding, is a framework for calculating CNN-related algorithms. At present, it is the most popular open source framework for deeplearning, so it is also used by the most people.
Caffe Web site: http://caffe.berkeleyvision.org/
Github Web site: https://github.com/BVLC/caffe/
Installation environment
System: Ubuntu14.04 Desktop x64 (it is recommended to use the newly installed system and do not update it, otherwise it will affect some of the following links)
Video card: a video card that supports CUDA. Of course, this is not necessary.
Dependent program basic package
Install some basic packages needed for development
Installation of scipy in sudo apt-get updatesudo apt-get install build-essentialsudo apt-get install gfortran # # python depends on gfortran
Note: although gcc is already available in the default environment of Ubuntu, it does not provide a compilation environment for gcc +, and it is more complicated to install the compilation environment alone, so one click of the build-essential command is provided to build the required compilation environment.
CUDA (optional)
Cuda is not necessary in compiling and using caffe. If you really don't have a graphics card that supports cuda or just want to try caffe, you don't need to use it for complex training. You don't have to install it.
Installation link: http://blog.csdn.net/honyniu/article/details/46387429
CuDNN (optional)
This library is based on cuda and is optional, of course.
Installation link: http://blog.csdn.net/honyniu/article/details/46388241
BLAS (required)
This library provides some of the basic matrix and vector libraries needed by caffe, which is required.
Installation link: http://blog.csdn.net/honyniu/article/details/46388915
OpenCV (required)
OpenCV provides a library for image processing and computer vision, which is necessary in caffe use, and it is best to compile and install it yourself.
Installation link: http://blog.csdn.net/honyniu/article/details/46390097
Other dependencies
Caffe requires some specific database operations, so you need to install leveldb, lmdb, hdf5 and other libraries. In addition, caffe uses some of google's libraries, such as protobuf and glog, which also need to be installed, with the following command.
Sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compilerMatlab and python
These two are not necessary, but caffe provides interfaces for bash, matlab and python, and many of caffe's visual interfaces are implemented through python, so installation is recommended.
Matlab is used here is Matlab-R2014A, here do not talk about how to install it, go to Baidu tutorials, default installation can be installed in the'/ usr/local/MATLAB' directory.
The default installation of ubuntu is version 2.7, but in order to install the Python development environment, it is convenient to compile other extension libraries in the future, as follows
Sudo apt-get install python-dev
Python is the virtual environment used. For the construction of virtual environment, please see http://blog.csdn.net/honyniu/article/details/46382929.
Activate the virtual environment
Source ENV/bin/activate
Install the dependency package that compiles pycaffe, go to the python folder in the caffe installation directory, and you will see a requirements.txt. First, change the line of protobuf to protobuf==2.5.0, and then execute the following command:
For req in $(cat requirements.txt); do pip install $req; done
We didn't install the anaconda package recommended by caffe here because we can't get into the desktop after installation. And the anaconda package is just a python collection library with all the options in requirements.txt. After installing the above libraries, there will be no effect if you don't install anaconda.
Configuring and compiling caffe programs
You can download the latest caffe code from the github URL of caffe above, or you can use the git command to obtain it, as follows
Git clone https://github.com/BVLC/caffe.gitcaffe configuration
Finally, this is the final step, and if you have installed all the caffe dependencies above, you can configure and compile caffe below.
First of all, copy the 'Makefile.config' file needed for generation. Example is provided under the caffe installation package. Note that directly copying the following may cause an error, because each line of command cannot be followed by a blank string, which may cause the compilation to fail.
Cp Makefile.config.example Makefile.config
Then modify the 'Makefile.config' file according to your own needs, here is my configuration and some comments.
# # Refer to http://caffe.berkeleyvision.org/installation.html# Contributions simplifying and improving our build system are inventor # cuDNN acceleration switch (uncomment to build with cuDNN). USE_CUDNN: = 1 # if you don't install cudnn, leave out # CPU-only switch (uncomment to build without GPU support). # CPU_ONLY: = 1 # if you don't install cuda It is not necessary to enable # To customize your choice of compiler, uncomment and set the following.# N.B. The default for Linux is gaming + and the default for OSX is clang++# CUSTOM_CXX: = usr/local/cuda installation # CUDA directory contains bin/ and lib/ directories that we need.CUDA_DIR: = / usr/local/cuda # cuda default installation directory (which is actually a soft link). Generally, it does not need to be modified. But if you do not install cuda, you need to note # On Ubuntu 14.04, if cuda tools are installed via# "sudo apt-get install nvidia-cuda-toolkit" > # CUDA_DIR: = / usr# CUDA architecture setting: going with all of them.# For CUDA < 6.0,comment the * _ 50 lines for compatibility.CUDA_ARCH: =-gencode arch=compute_20,code=sm_20\-gencode arch=compute_20,code=sm_21\-gencode arch=compute_30 Code=sm_30\-gencode arch=compute_35,code=sm_35\-gencode arch=compute_50,code=sm_50\-gencode arch=compute_50,code=compute_50# BLAS choice:# atlas for ATLAS (default) # mkl for MKL# open for OpenBlasBLAS: = mkl # Intel MKL is used here If you use ATLAS, please modify # Custom (MKL/ATLAS/OpenBLAS) include and lib directories.# Leave commented to accept the defaults for your choice of BLAS# (which should work)! BLAS_INCLUDE: = / opt/intel/mkl/include # if it is atlas Note the path of BLAS_LIB: / opt/intel/mkl/lib/intel64# This is required only if you will compile the matlab interface.# MATLAB directory should contain the mex binary in / bin.MATLAB_DIR: = / usr/local/MATLAB/R2014a # Matlab in these two paths If you do not install Matlab or do not need to compile the interface, you can leave out # MATLAB_DIR: = / Applications/MATLAB_R2012b.app# NOTE: this is required only if you will compile the python interface.# We need to be able to find Python.h and numpy/arrayobject.h.# setting is the path of the python library, using the virtual environment capy, which is the ENV mentioned all the time. Sometimes it may not work, or an error will be reported. If you don't know why, set the following export. It's usually no problem. PYTHON_INCLUDE: = / home/huayong/capy/include/python2.7\ / home/huayong/capy/lib/python2.7/site-packages/numpy/core/include#If it doesn't work above, you can try this below.export CPLUS_INCLUDE_PATH=/home/huayong/capy/include/python2.7:/home/huayong/capy/lib/python2.7/site-packages/numpy/core/include# Anaconda Python distribution is quite popular. Include path:# Verify anaconda location Sometimes it's in root.# ANACONDA_HOME: = / home/wenzheng/anaconda# PYTHON_INCLUDE: = $(ANACONDA_HOME) / include\ # $(ANACONDA_HOME) / include/python2.7\ # $/ lib/python2.7/site-packages/numpy/core/include\ # We need to be able to find libpythonX.X.so or .dylib.PYTHON _ LIB: = / usr/lib/x86_64-linux-gnu# PYTHON_LIB: = $(ANACONDA_HOME) / lib # Uncomment to support layers written in Python (will link against Python libs) WITH_PYTHON_LAYER: = Whatever else you find you need goes here.# INCLUDE_DIRS: = $(PYTHON_INCLUDE) / usr/local/include# LIBRARY_DIRS: = $(PYTHON_LIB) / usr/local/lib / usr/lib# Uncomment to use `pkg- config` to specify OpenCV library paths.# (Usually not necessary-- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.) USE_PKG_CONFIG: = 1BUILDL _ DIR: = buildDISTRIBUTE_DIR: = distribute# Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171# DEBUG: = compilation The ID of the GPU that 'make runtest' will use to run unit tests.TEST_GPUID: = compilation enable pretty build (comment to see full commands) Q? = @ caffe
Basic compilation, j stands for multithreaded compilation, generally the first two commands will not go wrong, the last one may go wrong, but sometimes it does not affect the use.
Make all-j8make alltest-j8make runtest
Compiling matlab and python interfaces is certainly not necessary, depending on your own requirements.
Make pycaffemake matcaffe on "how to install Ubuntu14.04 Caffe" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it out for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.