http://caffe.berkeleyvision.org/install_apt.html 참조
먼저 파이썬 환경을 셋업하자
만약 Anaconda Python을 사용한다면 위를 주석처리하고 아래의 줄을 찾아 주석을 해제한다.
ANACONDA_HOME := $(HOME)/anaconda
PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
# $(ANACONDA_HOME)/include/python2.7 \
# $(ANACONDA_HOME)/lib/python2.7/dist-packages/numpy/core/include \
# We need to be able to find libpythonX.X.so or .dylib.
# PYTHON_LIB := /usr/lib
PYTHON_LIB := $(ANACONDA_HOME)/lib
mkdir build
cd build
cmake ..
make all
make install
Prerequisites
Caffe has several dependencies:
- CUDA is required for GPU mode.
- library version 7+ and the latest driver version are recommended, but 6.* is fine too
- 5.5, and 5.0 are compatible but considered legacy
- BLAS via ATLAS, MKL, or OpenBLAS.
- Boost >= 1.55
protobuf
,glog
,gflags
,hdf5
Optional dependencies:
- OpenCV >= 2.4 including 3.0
- IO libraries:
lmdb
,leveldb
(note: leveldb requiressnappy
) - cuDNN for GPU acceleration (v6)
Pycaffe and Matcaffe interfaces have their own natural needs.
- For Python Caffe:
Python 2.7
orPython 3.3+
,numpy (>= 1.7)
, boost-providedboost.python
- For MATLAB Caffe: MATLAB with the
mex
compiler.
cuDNN Caffe: for fastest operation Caffe is accelerated by drop-in integration of NVIDIA cuDNN. To speed up your Caffe models, install cuDNN then uncomment the USE_CUDNN := 1
flag in Makefile.config
when installing Caffe. Acceleration is automatic. The current version is cuDNN v6; older versions are supported in older Caffe.
CPU-only Caffe: for cold-brewed CPU-only Caffe uncomment the CPU_ONLY := 1
flag in Makefile.config
to configure and build Caffe without CUDA. This is helpful for cloud or cluster deployment.
Python and/or MATLAB Caffe (optional)
Python
The main requirements are numpy
and boost.python
(provided by boost). pandas
is useful too and needed for some examples.
You can install the dependencies with
for req in $(cat requirements.txt); do pip install $req; done
but we suggest first installing the Anaconda Python distribution, which provides most of the necessary packages, as well as the hdf5
library dependency.
To import the caffe
Python module after completing the installation, add the module directory to your $PYTHONPATH
by export PYTHONPATH=/path/to/caffe/python:$PYTHONPATH
or the like. You should not import the module in the caffe/python/caffe
directory!
Caffe’s Python interface works with Python 2.7. Python 3.3+ should work out of the box without protobuf support. For protobuf support please install protobuf 3.0 alpha (https://developers.google.com/protocol-buffers/). Earlier Pythons are your own adventure.
MATLAB
Install MATLAB, and make sure that its mex
is in your $PATH
.
Caffe’s MATLAB interface works with versions 2015a, 2014a/b, 2013a/b, and 2012b.
for Ubuntu (< 17.04)
General 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
CUDA: Install by apt-get
or the NVIDIA .run
package. The NVIDIA package tends to follow more recent library and driver versions, but the installation is more manual. If installing from packages, install the library and latest driver separately; the driver bundled with the library is usually out-of-date. This can be skipped for CPU-only installation.
BLAS: install ATLAS by sudo apt-get install libatlas-base-dev
or install OpenBLAS by sudo apt-get install libopenblas-dev
or MKL for better CPU performance.
Python (optional): if you use the default Python you will need to sudo apt-get install
the python-dev
package to have the Python headers for building the pycaffe interface.
Compatibility notes, 16.04
CUDA 8 is required on Ubuntu 16.04.
Remaining dependencies, 14.04
Everything is packaged in 14.04.
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
CMake Build
In lieu of manually editing Makefile.config
to configure the build, Caffe offers an unofficial CMake build thanks to @Nerei, @akosiorek, and other members of the community. It requires CMake version >= 2.8.7. The basic steps are as follows:
mkdir build
cd build
cmake ..
make all
make install
make runtest
See PR #1667 for options and details.
'컴퓨터이야기' 카테고리의 다른 글
시그모이드함수 미분 (0) | 2018.02.05 |
---|---|
Pycaffe matcaffe 설치하기 (0) | 2017.11.08 |
openface repository (0) | 2017.11.02 |
openface 테스트 (0) | 2017.11.02 |
openface 설치하기 (0) | 2017.11.01 |