Windows10 및 환경에서 caffe 설치(새 버전)

21237 단어 matlabwindowscaffe
Windows10 및 환경에서 caffe 설치(새 버전)
내 운영 환경 VS2015, Anaconda3(python 3.5 현재 커피는python 3.5까지), Matlab 201X, 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컴파일은 아래를 보십시오.
윈도우즈 설치http://blog.csdn.net/darren2015zdc/article/details/74504917카페 설치 의존 라이브러리 다운로드 경로https://github.com/willyd/caffe-builder/releases자신의 VS,python 환경에 따라 다운로드 선택
커피 의존 라이브러리 설치
1. 카페 다운로드
git clone https://github.com/BVLC/caffe.git
cd caffe
git checkout windows
#        
#scripts\build_win.cmd

2. build 수정win.cmd
caffe\scripts\build 열기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
)

그런 다음 커피에서 실행:scripts\buildwin.cmd
카페 설치
실행:scripts\buildwin.cmd 다운로드가 자주 실패합니다.직접https://github.com/willyd/caffe-builder/releases다음에 지원하는 패키지 다운로드에 실패한 커피가 생성한build,zdc.caffe\dependencies\download\를 삭제해야 합니다.좋은 의존 가방을 다운로드해서 놓으세요.caffe\dependencies\download\아래.
C:\Users\zdc\.caffe\dependencies\download\libraries_v140_x64_py35_1.1.0.tar.bz2

커피에서 생성한build을 정리하고scripts\build 를 다시 실행합니다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 컴파일 설치 커피
scripts\build_win.cmd의 WITH 설정NINJA
 if NOT DEFINED WITH_NINJA set WITH_NINJA=0 

파이썬 테스트
C:\Users\zdc\caffe\python 경로로 전환:
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:\Users\zdc\caffe\matlab 경로로 전환합니다.다음 명령을 입력합니다. 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_.mexw64는\caffe\matlab+caffe\private\Release 또는\caffe\matlab+caffe\private\Debug에 나타납니다.Ninja가 컴파일한 caffe.mexw64는\caffe\matlab+caffe\private\에 직접 나타납니다.비교적 편리한 방법:\caffe\matlab+caffe\private\Release의caffe.mexw64를\caffe\matlab+caffe\private\로 복사하면 됩니다
참조:
이전 버전 설치 참조:http://blog.csdn.net/qq_14845119/article/details/52415090Windows에서 Caffe 설치 상세 정보 (cpu+gpu+matcaffe+pycaffe) 새 버전 설치 참고 사항:http://blog.csdn.net/thomaszhaoyc/article/details/68489299winsows10에서 nja로 설정 커피 컴파일
Windows에서 VS2015 컴파일 커피(CPU ONLY)http://blog.csdn.net/light169/article/details/53993893
MATLAB에서 Caffe 디버깅http://blog.csdn.net/kkk584520/article/details/49475633
matlab+mnist 훈련된 카페 모형을 호출하여 필기체 식별http://blog.csdn.net/a571255945/article/details/51694782
[caffe-Windows] 마이크로소프트 공식 caffe의 matlab 인터페이스 설정http://m.blog.csdn.net/zb1165048017/article/details/51702686

좋은 웹페이지 즐겨찾기