Меню Рубрики

Установка caffe на windows

Caffe

Deep learning framework by BAIR

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 16.04–12.04, OS X 10.11–10.8, and through Docker and AWS. The official Makefile and Makefile.config build are complemented by a community CMake build.

Step-by-step Instructions:

Overview:

When updating Caffe, it’s best to make clean before re-compiling.

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
  • OpenCV >= 2.4 including 3.0
  • IO libraries: lmdb , leveldb (note: leveldb requires snappy )
  • cuDNN for GPU acceleration (v6)

Pycaffe and Matcaffe interfaces have their own natural needs.

  • For Python Caffe: Python 2.7 or Python 3.3+ , numpy (>= 1.7) , boost-provided boost.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.

CUDA and BLAS

Caffe requires the CUDA nvcc compiler 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 := 1 flag 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 free licenses.
    1. Install MKL.
    2. Set up MKL environment (Details: Linux, OS X). Example: source /opt/intel/mkl/bin/mklvars.sh intel64
    3. Set BLAS := mkl in Makefile.config
  • OpenBLAS: free and open source; this optimized and parallel BLAS could require more effort to install, although it might offer a speedup.
    1. Install OpenBLAS
    2. Set BLAS := open in Makefile.config

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

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.

Compilation

Caffe can be compiled with either Make or CMake. Make is officially supported while CMake is supported by the community.

Compilation with Make

Configure the build by copying and modifying the example Makefile.config for your setup. The defaults should work, but uncomment the relevant lines if using Anaconda Python.

  • For CPU & GPU accelerated Caffe, no changes are needed.
  • For cuDNN acceleration using NVIDIA’s proprietary cuDNN software, uncomment the USE_CUDNN := 1 switch in Makefile.config . cuDNN is sometimes but not always faster than Caffe’s GPU acceleration.
  • For CPU-only Caffe, uncomment CPU_ONLY := 1 in Makefile.config .

To compile the Python and MATLAB wrappers do make pycaffe and make matcaffe respectively. Be sure to set your MATLAB and Python paths in Makefile.config first!

Distribution: run make distribute to create a distribute directory 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 -j8 where 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.

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:

See PR #1667 for options and details.

Hardware

Laboratory Tested Hardware: Berkeley Vision runs Caffe with Titan Xs, K80s, GTX 980s, K40s, K20s, Titans, and GTX 770s including models at ImageNet/ILSVRC scale. 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 = 3.0.

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.

Источник

Install and Configure Caffe on windows 10

Series

Guide

  • windows: 10
  • caffe: caffe-windows
  • nvidia driver: gtx 1060 382.05 (gtx 970m)
  • GPU arch(s): sm_61 (sm_52)
  • cuda: 8.0
  • cudnn: 5.0.5
  • opencv: 3.1.0 WITH_CUDA (compiled from source)
  • other libs: libraries_v140_x64_py27_1.1.0.tar.bz2

cuda+cudnn

  1. download and install driver by standalone for GTX 970 or GTX 1060 from here.
  2. download and install cuda_8.0.61_win10.exe , skip install nvidia driver and install toolkit only.
  3. download and install cudnn-8.0-windows10-x64-v5.0-ga.zip .

nvidia driver

driver can be installed by standalone or from cuda_xxx_win10.exe .
we choose to install by standalone

download proper driver for GTX 970 or GTX 1060 eg: 398.36-notebook-win10-64bit-international-whql.exe from here

cuda toolkit

download cuda_8.0.61_win10.exe from here

The CUDA Toolkit installs the CUDA driver and tools needed to create, build and run a CUDA application as well as libraries, header files, CUDA samples source code, and other resources

cuda_8.0.61_win10.exe includes: Nvidia driver + toolkit.

  • driver install to C:/Program Files/NVIDIA Corporation and C:/ProgramData/NVIDIA Corporation
  • tookit install to C:/Program Files/NVIDIA GPU Computing Toolkit ,which contains headers,libs,tools for compiling CUDA applications. C:/ProgramData/NVIDIA GPU Computing Toolkit contains cuda plugins for Visual Studio.

cudnn

extract cudnn-8.0-windows10-x64-v5.0-ga.zip and copy include , lib and bin to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0

check cuda

compile

download

  • caffe-windows
  • caffe depencencies
  1. place caffe-windows at C:/compile/caffe-windows
  2. extract libraries_v140_x64_py27_1.1.0.tar.bz2 to C:\Users\zunli\.caffe\dependencies\libraries_v140_x64_py27_1.1.0\libraries

config

Tips:
(1) we use C:\Boost\ 1.64 to replace caffe dependencies C:\Users\zunli\.caffe\dependencies\libraries_v140_x64_py27_1.1.0\libraries\ 1.61, because we have compile PCL 1.8.1 with Boost 1.64 static .
(2) we use caffe C:\Users\zunli\.caffe\dependencies\libraries_v140_x64_py27_1.1.0\libraries\x64\vc14\lib to replace C:/Program Files/opencv . (opencv3.1 Release x64 with Visual Studio 2015 and 38 modules will be generated and We Install to C:/car_libs/caffe/ .

build result.

install to C:/car_libs/caffe .

caffe usage

CMakeLists.txt

when we use caffe lib in our program, errors will occur. And we need to fix CaffeTargets-release.cmake file。

usage error fix

(1) error with shared.lib

hdf5.lib ===> libcaffehdf5.lib
hdf5_hl.lib ===> libcaffehdf5_hl.lib

(3) error with libopenblas

cd C:\Users\zunli\.caffe\dependencies\libraries_v140_x64_py27_1.1.0\libraries\lib and

  • copy libopenblas.a ===> libopenblas.a.lib
  • copy libopenblas.dll.a ===> libopenblas.dll.a.lib

CaffeTargets-release.cmake

comiple errors with caffe.pb.h

tips: sometimes we not need to do this.

replace STRICT and PERMISSIVE to _STRICT and _PERMISSIVE .

run exe

  • copy C:/car_libs/caffe/bin/*.dll dlls to bin/release folder.
  • copy Opencv dlls to bin/release folder.

Errors and Solutions

nvidia driver not compatible with windows 10

problem: install nvidia driver failed on windows 10

Источник

Установка caffe на windows

Caffe is a deep learning framework made with expression, speed, and modularity in mind. It is developed by Berkeley AI Research (BAIR)/The Berkeley Vision and Learning Center (BVLC) and community contributors.

Check out the project site for all the details like

and step-by-step examples.

Requirements: Visual Studio 2015, CUDA 9.0, third party libraries: Baidu Yun or Google Drive. Please extract the archive into ./windows/thirdparty/ . Then, add the folder ./windows/thirdparty/bins to the environment variable PATH .

Copy .\windows\CommonSettings.props.example to .\windows\CommonSettings.props

By defaults Windows build requires CUDA and cuDNN libraries. Both can be disabled by adjusting build variables in .\windows\CommonSettings.props . Python support is disabled by default, but can be enabled via .\windows\CommonSettings.props as well.

Download CUDA Toolkit 8.0 from nVidia website. If you don’t have CUDA installed, you can experiment with CPU_ONLY build. In .\windows\CommonSettings.props set CpuOnlyBuild to true and set UseCuDNN & UseNCCL to false .

Download cuDNN v5 from nVidia website. Unpack downloaded zip to %CUDA_PATH% (environment variable set by CUDA installer). Alternatively, you can unpack zip to any location and set CuDnnPath to point to this location in .\windows\CommonSettings.props . CuDnnPath defined in .\windows\CommonSettings.props . Also, you can disable cuDNN by setting UseCuDNN to false in the property file.

To build Caffe Python wrapper set PythonSupport to true in .\windows\CommonSettings.props . Download Miniconda 2.7 64-bit Windows installer [from Miniconda website] (http://conda.pydata.org/miniconda.html). Install for all users and add Python to PATH (through installer).

Run the following commands from elevated command prompt:

After you have built solution with Python support, in order to use it you have to either:

  • set PythonPath environment variable to point to \Build\x64\Release\pycaffe , or
  • copy folder \Build\x64\Release\pycaffe\caffe under

To build Caffe Matlab wrapper set MatlabSupport to true and MatlabDir to the root of your Matlab installation in .\windows\CommonSettings.props .

After you have built solution with Matlab support, in order to use it you have to add the ./matlab folder to Matlab search path.

Now, you should be able to build .\windows\Caffe.sln

License and Citation

Caffe is released under the BSD 2-Clause license. The BAIR/BVLC reference models are released for unrestricted use.

Please cite Caffe in your publications if it helps your research:

About

Configure Caffe in one hour for Windows users.

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

  • Установка cab windows 10 mobile
  • Установка boost под windows
  • Установка bmw tis на windows 7
  • Установка bmw inpa на windows 10
  • Установка bluetooth мыши windows 7