Windows 10と環境でのcaffeのインストール(新版)
Windows 10と環境でのcaffeのインストール(新版)
私の運転環境VS 2015,Anaconda 3(python 3.5現在caffeはpython 3.5まで)、Matlab 201 X,CMake 3.8
Requirements
参照先:https://github.com/BVLC/caffe/tree/windows
Visual Studio 2013 or 2015 CMake 3.4 or higher (Visual Studio and Ninja generators are supported) CMake: https://cmake.org/ Ninja: https://ninja-build.org/インストールリファレンス:NinjaではなくVSコンパイルを使用する場合は、インストールせずに使用できます.VSコンパイルは次のとおりです.
Windowsインストールninjahttp://blog.csdn.net/darren2015zdc/article/details/74504917Caffeインストール依存ライブラリのダウンロードパスhttps://github.com/willyd/caffe-builder/releases自分のVSによってpython環境はダウンロードを選択します
caffeの依存ライブラリのインストール
1.caffeのダウンロード
git clone https://github.com/BVLC/caffe.git
cd caffe
git checkout windows
#
#scripts\build_win.cmd
2.build_の変更win.cmd
caffescriptsbuild_を開くwin.cmdはpythonで使用するために
#:: Check that we have the right python version
!PYTHON_EXE! --version
#:: Add the required channels
conda config --add channels conda-forge
conda config --add channels willyd
#:: Update conda
conda update conda -y
#:: Download other required packages
conda install --yes cmake ninja numpy scipy protobuf==3.1.0 six scikit-image pyyaml pydotplus graphviz
elseで修正する
else (
:: Change the settings here to match your setup
:: Change MSVC_VERSION to 12 to use VS 2013
if NOT DEFINED MSVC_VERSION set MSVC_VERSION=14
:: Change to 1 to use Ninja generator (builds much faster)
# NINJA WITH_NINJA=1
if NOT DEFINED WITH_NINJA set WITH_NINJA=1
:: Change to 1 to build caffe without CUDA support
# gpu, CPU_ONLY=0
if NOT DEFINED CPU_ONLY set CPU_ONLY=0
:: Change to generate CUDA code for one of the following GPU architectures
:: [Fermi Kepler Maxwell Pascal All]
if NOT DEFINED CUDA_ARCH_NAME set CUDA_ARCH_NAME=Auto
:: Change to Debug to build Debug. This is only relevant for the Ninja generator the Visual Studio generator will generate both Debug and Release configs
if NOT DEFINED CMAKE_CONFIG set CMAKE_CONFIG=Release
:: Set to 1 to use NCCL
# GPU 。 GPU
if NOT DEFINED USE_NCCL set USE_NCCL=0
:: Change to 1 to build a caffe.dll
if NOT DEFINED CMAKE_BUILD_SHARED_LIBS set CMAKE_BUILD_SHARED_LIBS=0
:: Change to 3 if using python 3.5 (only 2.7 and 3.5 are supported)
# python3.5 PYTHON_VERSION=3
if NOT DEFINED PYTHON_VERSION set PYTHON_VERSION=3
:: Change these options for your needs.
if NOT DEFINED BUILD_PYTHON set BUILD_PYTHON=1
if NOT DEFINED BUILD_PYTHON_LAYER set BUILD_PYTHON_LAYER=1
# matcaffe matlab BUILD_MATLAB=1
if NOT DEFINED BUILD_MATLAB set BUILD_MATLAB=1
:: If python is on your path leave this alone
if NOT DEFINED PYTHON_EXE set PYTHON_EXE=python
:: Run the tests
if NOT DEFINED RUN_TESTS set RUN_TESTS=0
:: Run lint
if NOT DEFINED RUN_LINT set RUN_LINT=0
:: Build the install target
if NOT DEFINED RUN_INSTALL set RUN_INSTALL=0
)
次にcaffeで実行:scriptsbuild_win.cmd
インストールcaffe
実行:scriptsbuild_win.cmdダウンロードはよく失敗します.直接https://github.com/willyd/caffe-builder/releases次回、サポートされているパッケージのダウンロードに失敗したcaffeで生成されたbuild,zdc.caffedependenciesdownloadを削除する必要があります.ダウンロードした依存パッケージは、caffedependenciesdownload下.
C:\Users\zdc\.caffe\dependencies\download\libraries_v140_x64_py35_1.1.0.tar.bz2
caffeで生成されたbuildをクリーンアップし、scriptsbuild_を再実行します.win.cmd
INFO: ============================================================
INFO: Summary:
INFO: ============================================================
INFO: MSVC_VERSION = 14
INFO: WITH_NINJA = 1
INFO: CMAKE_GENERATOR = "Ninja"
INFO: CPU_ONLY = 0
INFO: CUDA_ARCH_NAME = Auto
INFO: CMAKE_CONFIG = Release
INFO: USE_NCCL = 0
INFO: CMAKE_BUILD_SHARED_LIBS = 0
INFO: PYTHON_VERSION = 3
INFO: BUILD_PYTHON = 1
INFO: BUILD_PYTHON_LAYER = 1
INFO: BUILD_MATLAB = 1
INFO: PYTHON_EXE = "python"
INFO: RUN_TESTS = 0
INFO: RUN_LINT = 0
INFO: RUN_INSTALL = 0
INFO: ============================================================
-- The C compiler identification is MSVC 19.0.24215.1
-- The CXX compiler identification is MSVC 19.0.24215.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: C:/Users/zdc/Anaconda3/python.exe (found suitable version "3.5.2", minimum required is "2.7")
-- Extracting dependencies
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Boost version: 1.61.0
-- Found the following Boost libraries:
-- system
-- thread
-- filesystem
-- chrono
-- date_time
-- atomic
-- Found GFlags: C:/Users/zdc/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/include
-- Found gflags (include: C:/Users/zdc/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/include, library: gflags_shared)
-- Found Glog: C:/Users/zdc/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/include
-- Found glog (include: C:/Users/zdc/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/include, library: glog)
VSコンパイルインストールcaffe
scripts\build_win.cmdでの設定WITH_NINJA
if NOT DEFINED WITH_NINJA set WITH_NINJA=0
Pythonのテスト
C:Userszdccaffepythonパスに切り替えます.
C:\Users\zdc\caffe>cd python
C:\Users\zdc\caffe\python>python
Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import caffe
>>> quit()
Matlabのテスト
MatlabをC:Userszdccaffematlabパスに切り替えます.次のコマンドを入力します:caffe.run_tests()
>> caffe.run_tests()
Cleared 0 solvers and 0 stand-alone nets
caffe.test.test_net
.....
caffe.test.test_net
__________
: 'caffe.Solver' , :
caffe_
Usage: caffe_('delete_solver', hSolver)
caffe.Solver/delete (line 40)
caffe_('delete_solver', self.hSolver_self);
caffe.Solver (line 21)
self = caffe.get_solver(varargin{:});
caffe.test.test_solver (line 22)
self.solver = caffe.Solver(solver_file);
caffe.run_tests (line 14)
run(caffe.test.test_solver) ...
> In caffe.Solver (line 21)
In caffe.test.test_solver (line 22)
In caffe.run_tests (line 14)
caffe.test.test_solver
.
caffe.test.test_solver
__________
caffe.test.test_io
.
caffe.test.test_io
__________
Cleared 0 solvers and 0 stand-alone nets
ans =
1×7TestResult ( ):
Name
Passed
Failed
Incomplete
Duration
Details
:
7 Passed, 0 Failed, 0 Incomplete.
0.76046 。
テストが成功したことを示す
VSコンパイルでは以下の問題が発生します.
'caffe_'。 'caffe_' not found
caffe_.mexw 64は、caffematlab+caffeprivateReleaseまたはcaffematlab+caffeprivateDebugに表示されます.Ninjaコンパイルcaffe_.mexw 64は、caffematlab+caffeprivateに直接表示されます.手間を省く方法:私は直接caffematlab+caffeprivateReleaseのcaffe_.mexw 64をcaffematlab+caffeprivateにコピーすればいい
参照先:
古いバージョンのインストールリファレンス:http://blog.csdn.net/qq_14845119/article/details/52415090Windowsでのcaffeインストールの詳細(cpu+gpu+matcaffe+pycaffe)新しいバージョンのインストールリファレンス:http://blog.csdn.net/thomaszhaoyc/article/details/68489299winsows 10でninjaで構成caffeをコンパイル
Windows下VS 2015コンパイルcaffe(CPU ONLY)http://blog.csdn.net/light169/article/details/53993893
MATLABでCaffeをデバッグするhttp://blog.csdn.net/kkk584520/article/details/49475633
matlab+mnistは訓練したcaffeモデルを呼び出して手書き認識を行うhttp://blog.csdn.net/a571255945/article/details/51694782
【caffe-Windows】マイクロソフト公式caffeのmatlabインタフェース構成http://m.blog.csdn.net/zb1165048017/article/details/51702686