caffe 自己安装记录,cpu版
2016-02-18 17:27
351 查看
参考官方文档 依赖库安装 Ubuntu14.02版本 https://github.com/BVLC/caffe/blob/master/docs/install_apt.md
编译教程: https://github.com/BVLC/caffe/blob/master/docs/installation.md
General dependencies
注意: opencv, boost 最好安装高版本的库,高版本的库速度可能会快一些。zm$ apt-cache search opencv 能够查看的版本,方便安装指定版本的opencv。2------- 暂时只打算编译cpu版本,所以只cuda 安装这步直接跳过。CUDA: Install via the NVIDIA package instead of
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.3------------------直接只用提供的命令行 sudo apt-get install libatlas-base-devBLAS: install ATLAS by
performance.4--------------------------------直接使用给定的命令行,
to have the Python headers for building the pycaffe interface.注意: 如果需要编译pycaffe,还需要安装python-numpy库,这步不安装,编译pycaffe时会提示错误。安装命令为:
Prior to installing, have a glance through this guide and take note of the details for your platform. We install and run Caffe on Ubuntu 14.04 and 12.04, OS X 10.10 / 10.9 / 10.8, and AWS. The official Makefile and
are complemented by an automatic CMake build from the community.Prerequisites
Compilation
Hardware
Platforms: Ubuntu guide, OS
X guide, and RHEL / CentOS / Fedora guideWhen updating Caffe, it's best to
Caffe has several dependencies:CUDA is required for GPU mode.library version 7.0 and the latest driver version are recommended, but 6.* is fine too
5.5, and 5.0 are compatible but considered legacyBLAS via ATLAS, MKL, or OpenBLAS.
Boost >= 1.55
IO libraries:
leveldb requires
cuDNN for GPU acceleration (v3)Pycaffe and Matcaffe interfaces have their own natural needs.For Python Caffe:
For MATLAB Caffe: MATLAB with the
To speed up your Caffe models, install cuDNN then uncomment the
installing Caffe. Acceleration is automatic. The current version is cuDNN v3; older versions are supported in older Caffe.CPU-only Caffe: for cold-brewed CPU-only Caffe uncomment the
configure and build Caffe without CUDA. This is helpful for cloud or cluster deployment.
Caffe requires the CUDA
CUDA website and follow installation instructions there. Install the library and the latest standalone driver separately; the driver bundled with the library is usually out-of-date. Warning! The 331.* CUDA driver series has a critical
performance issue: do not use it.For best performance, Caffe can be accelerated by NVIDIA cuDNN. Register for free at the cuDNN site, install it,
then continue with these installation instructions. To compile with cuDNN set the
Intel MKL: commercial and optimized for Intel CPUs, with a free trial and student licenses.Install MKL.
Set
it might offer a speedup.Install OpenBLAS
Set
The main requirements are
by boost).
packages, as well as the
Earlier Pythons are your own adventure.
Install MATLAB, and make sure that its
There is an unofficial Windows port of Caffe at niuzhiheng/caffe:windows. Thanks @niuzhiheng!
Caffe can be compiled with either Make or CMake. Make is officially supported while CMake is supported by the community.
5---------------编译,----------------------------------------------------------------------------------
这里只编译cpu版本,
For CPU-only Caffe, uncomment
sudo apt-get install
sh data/mnist/get_mnist.sh
打开 example/mnist/lenet_solver.prototxt 文件,把 GPU 改为 CPU ,最后 sh example/mnist/train_lenet.shmnist例子跑通,安装完毕。
Configure the build by copying and modifying the example
the relevant lines if using Anaconda Python.
For cuDNN acceleration using NVIDIA's proprietary cuDNN software, uncomment the
cuDNN is sometimes but not always faster than Caffe's GPU acceleration.
For CPU-only Caffe, uncomment
with all the Caffe headers, compiled libraries, binaries, etc. needed for distribution to other machines.Speed: for a faster build, compile in parallel by doing
for compilation (a good choice for the number of threads is the number of cores in your machine).Now that you have installed Caffe, check out the MNIST tutorial and the reference
ImageNet model tutorial.
In lieu of manually editing
and other members of the community. It requires CMake version >= 2.8.7. The basic steps are as follows:
Laboratory Tested Hardware: Berkeley Vision runs Caffe with K40s, K20s, and Titans including models at ImageNet/ILSVRC scale. We also run on GTX series cards (980s and 770s) and GPU-equipped MacBook Pros. We have not encountered any trouble
in-house with devices with CUDA capability >= 3.0. All reported hardware issues thus-far have been due to GPU configuration, overheating, and the like.CUDA compute capability: devices with compute capability <= 2.0 may have to reduce CUDA thread numbers and batch sizes due to hardware constraints. Your mileage may vary.Once installed, check your times against our reference performance numbers to
make sure everything is configured properly.Ask hardware questions on the caffe-users group.
编译教程: https://github.com/BVLC/caffe/blob/master/docs/installation.md
--- title: Installation: Ubuntu ---
Ubuntu
Installation
General dependenciessudo 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-dev1 直接使用提供的 命令即可
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
注意: opencv, boost 最好安装高版本的库,高版本的库速度可能会快一些。zm$ apt-cache search opencv 能够查看的版本,方便安装指定版本的opencv。2------- 暂时只打算编译cpu版本,所以只cuda 安装这步直接跳过。CUDA: Install via the NVIDIA package instead of
apt-getto be certain of the library and driver versions.
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.3------------------直接只用提供的命令行 sudo apt-get install libatlas-base-devBLAS: install ATLAS by
sudo apt-get install libatlas-base-devor install OpenBLAS or MKL for better CPU
performance.4--------------------------------直接使用给定的命令行,
sudo apt-get install
python-devPython (optional): if you use the default Python you will need to
sudo apt-get installthe
python-devpackage
to have the Python headers for building the pycaffe interface.注意: 如果需要编译pycaffe,还需要安装python-numpy库,这步不安装,编译pycaffe时会提示错误。安装命令为:
sudo apt-get install
python-numpy到这里 库的安装就完成了。下边到了编译过程。Remaining dependencies, 14.04Everything is packaged in 14.04.
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-devRemaining dependencies, 12.04These dependencies need manual installation in 12.04.
# glog wget https://google-glog.googlecode.com/files/glog-0.3.3.tar.gz tar zxvf glog-0.3.3.tar.gz cd glog-0.3.3 ./configure make && make install # gflags wget https://github.com/schuhschuh/gflags/archive/master.zip unzip master.zip cd gflags-master mkdir build && cd build export CXXFLAGS="-fPIC" && cmake .. && make VERBOSE=1 make && make install # lmdb git clone https://github.com/LMDB/lmdb cd lmdb/libraries/liblmdb make && make installNote that glog does not compile with the most recent gflags version (2.1), so before that is resolved you will need to build with glog first.Continue with compilation.------------------------------------------------------------------------------------------------------------------------------------------------------开始编译--------------------------------------------------------------------------------------------------------------------------------------------------------
Installation
Prior to installing, have a glance through this guide and take note of the details for your platform. We install and run Caffe on Ubuntu 14.04 and 12.04, OS X 10.10 / 10.9 / 10.8, and AWS. The official Makefile and Makefile.configbuild
are complemented by an automatic CMake build from the community.Prerequisites
Compilation
Hardware
Platforms: Ubuntu guide, OS
X guide, and RHEL / CentOS / Fedora guideWhen updating Caffe, it's best to
make cleanbefore re-compiling.
Prerequisites
Caffe has several dependencies:CUDA is required for GPU mode.library version 7.0 and the latest driver version are recommended, but 6.* is fine too5.5, and 5.0 are compatible but considered legacyBLAS via ATLAS, MKL, or OpenBLAS.
Boost >= 1.55
protobuf,
glog,
gflags,
hdf5Optional dependencies:OpenCV >= 2.4 including 3.0
IO libraries:
lmdb,
leveldb(note:
leveldb requires
snappy)
cuDNN for GPU acceleration (v3)Pycaffe and Matcaffe interfaces have their own natural needs.For Python Caffe:
Python 2.7or
Python 3.3+,
numpy (>= 1.7), boost-provided
boost.python
For MATLAB Caffe: MATLAB with the
mexcompiler.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 := 1flag in
Makefile.configwhen
installing Caffe. Acceleration is automatic. The current version is cuDNN v3; older versions are supported in older Caffe.CPU-only Caffe: for cold-brewed CPU-only Caffe uncomment the
CPU_ONLY := 1flag in
Makefile.configto
configure and build Caffe without CUDA. This is helpful for cloud or cluster deployment.
CUDA
and BLAS
Caffe requires the CUDA nvcccompiler to compile its GPU code and CUDA driver for GPU operation. To install CUDA, go to the NVIDIA
CUDA website and follow installation instructions there. Install the library and the latest standalone driver separately; the driver bundled with the library is usually out-of-date. Warning! The 331.* CUDA driver series has a critical
performance issue: do not use it.For best performance, Caffe can be accelerated by NVIDIA cuDNN. Register for free at the cuDNN site, install it,
then continue with these installation instructions. To compile with cuDNN set the
USE_CUDNN := 1flag set in your
Makefile.config.Caffe requires BLAS as the backend of its matrix and vector computations. There are several implementations of this library. The choice is yours:ATLAS: free, open source, and so the default for Caffe.
Intel MKL: commercial and optimized for Intel CPUs, with a free trial and student licenses.Install MKL.
Set
BLAS := mklin
Makefile.configOpenBLAS: free and open source; this optimized and parallel BLAS could require more effort to install, although
it might offer a speedup.Install OpenBLAS
Set
BLAS := openin
Makefile.config
Python
and/or MATLAB Caffe (optional)
Python
The main requirements are numpyand
boost.python(provided
by boost).
pandasis useful too and needed for some examples.You can install the dependencies with
for req in $(cat requirements.txt); do pip install $req; donebut we suggest first installing the Anaconda Python distribution, which provides most of the necessary
packages, as well as the
hdf5library dependency.To import the
caffePython module after completing the installation, add the module directory to your
$PYTHONPATHby
export PYTHONPATH=/path/to/caffe/python:$PYTHONPATHor the like. You should not import the module in the
caffe/python/caffedirectory!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 mexis in your
$PATH.Caffe's MATLAB interface works with versions 2015a, 2014a/b, 2013a/b, and 2012b.
Windows
There is an unofficial Windows port of Caffe at niuzhiheng/caffe:windows. Thanks @niuzhiheng!
Compilation
Caffe can be compiled with either Make or CMake. Make is officially supported while CMake is supported by the community.5---------------编译,----------------------------------------------------------------------------------
cp Makefile.config.example Makefile.config
这里只编译cpu版本,
vim Makefile.config
For CPU-only Caffe, uncomment
CPU_ONLY := 1in
Makefile.config.最后 make -j 使用所有的核 编译,这样编译的速度最快-------------------------------------------------------------------------------------------[/code]
5---------------编译 Pycaffe----------------------------------------------------------------------------------
cp Makefile.config.example Makefile.config
pycaffe 需要 numpy 库的支持,所以需要安装Python-numpy 库
sudo apt-get install python-numpy
最后 make pycaffe 即可
5---------------测试:跑mnist 例子---------------------------------------------------------------------------------
sh data/mnist/get_mnist.shsh example/mnist/creat_mnist.sh
打开 example/mnist/lenet_solver.prototxt 文件,把 GPU 改为 CPU ,最后 sh example/mnist/train_lenet.shmnist例子跑通,安装完毕。
Compilation
with Make
Configure the build by copying and modifying the example Makefile.configfor your setup. The defaults should work, but uncomment
the relevant lines if using Anaconda Python.
cp Makefile.config.example Makefile.config # Adjust Makefile.config (for example, if using Anaconda Python, or if cuDNN is desired) make all make test make runtestFor CPU & GPU accelerated Caffe, no changes are needed.
For cuDNN acceleration using NVIDIA's proprietary cuDNN software, uncomment the
USE_CUDNN := 1switch in
Makefile.config.
cuDNN is sometimes but not always faster than Caffe's GPU acceleration.
For CPU-only Caffe, uncomment
CPU_ONLY := 1in
Makefile.config.To compile the Python and MATLAB wrappers do
make pycaffeand
make matcafferespectively. Be sure to set your MATLAB and Python paths in
Makefile.configfirst!Distribution: run
make distributeto create a
distributedirectory
with all the Caffe headers, compiled libraries, binaries, etc. needed for distribution to other machines.Speed: for a faster build, compile in parallel by doing
make all -j8where 8 is the number of parallel threads
for compilation (a good choice for the number of threads is the number of cores in your machine).Now that you have installed Caffe, check out the MNIST tutorial and the reference
ImageNet model tutorial.
Compilation
with CMake
In lieu of manually editing Makefile.configto 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 runtestSee PR #1667 for options and details.
Hardware
Laboratory Tested Hardware: Berkeley Vision runs Caffe with K40s, K20s, and Titans including models at ImageNet/ILSVRC scale. We also run on GTX series cards (980s and 770s) and GPU-equipped MacBook Pros. We have not encountered any troublein-house with devices with CUDA capability >= 3.0. All reported hardware issues thus-far have been due to GPU configuration, overheating, and the like.CUDA compute capability: devices with compute capability <= 2.0 may have to reduce CUDA thread numbers and batch sizes due to hardware constraints. Your mileage may vary.Once installed, check your times against our reference performance numbers to
make sure everything is configured properly.Ask hardware questions on the caffe-users group.
相关文章推荐
- JS字符串的相关方法
- HTML5 中的meter 标签的样式设置
- js图片预加载
- 前端开发的基础知识点摘要
- js图片预加载
- 表单填写不完整提交按钮灰色,填写完整自动解除解禁+jQuery验证提示
- 2015年需要了解的前端框架和语言
- JavaScript DOM接口
- html5 canvas 画hello ketty
- 我们为什么要看《超实用的HTML代码段》
- JavaScript DOM
- sublime text3 JS语法检测插件
- JavaScript运算优先级
- JSON
- jQuery使用说明
- JavaScript特殊运算符
- JavaScript比较运算
- 前端开发框架对比
- 闭包 js
- JavaScript逻辑运算