How to compile caffe on Windows 10

*UPDATE*: Updated instructions at this link < http://www.shaneahmed.com/2017/07/build-caffe-pycaffe-and-matcaffe-on.html >

Requirements:

Download and install the following software's:
  1. Visual Studio 2015 https://www.visualstudio.com/downloads/
  2. Make 3.4 or higher https://cmake.org/download/
  3. Python 3.5 Anaconda x64 (Required to build pycaffe). https://repo.continuum.io/archive/Anaconda3-4.2.0-Windows-x86_64.exe
  4. CUDA 8.0 https://developer.nvidia.com/accelerated-computing-toolkit
  5. cuDNN v5.1 (optional) https://developer.nvidia.com/cudnn
  6. Matlab (Required to build matcaffe)  http://mathworks.com

    Instructions:

    1. Install CUDA v8.0
    2. Extract cuDNN folder
      • copy all files from bin folder to 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin'
      • similarly from include to 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include' 
      • and 'lib/x64' to  ''C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib/x64'.
    3. Install Anaconda, make sure you select Register Anaconda as system path for Python 3.5
    4. Install and activate Matlab using your Matlab licence (only if you need to build matcaffe).
    5. Open command window in the desired folder "C:\Projects" (Shift+RightClick and Open Command Window here).
    6. Enter the following commands
    7. C:\Projects> git clone https://github.com/BVLC/caffe.git
      C:\Projects> cd caffe
      C:\Projects\caffe> git checkout windows
    8. Open scripts folder and edit build_win.cmd
      • set path for python and add path to Anaconda folder.
    9. set BUILD_MATLAB=1
    10. set -CUDNN_ROOT path to "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0" in cmake configuration in line 146.
    11. Edit CMakeLists.txt and make changes according to instructions in https://github.com/BVLC/caffe/pull/4928/files
    12. Enter following command
    13. C:\Projects\caffe> scripts\build_win.cmd
    14. You can find caffe.exe in C:\Projects\caffe\build\tools\release\caffe.exe
    15. Enter
    16. C:\Projects\caffe> call build\libraries\prependpath.bat
    17. Now you should be able to run 
    18. C:\Projects\caffe> build\tools\release\caffe.exe -help

      Pycaffe instructions:

    19. Enter the following commands
    20. conda config --add channels conda-forge
      conda install ninja --yes
    21. Copy the contents of C:\Projects\caffe\python to [C:\Program Files\Anaconda3\]Lib\site-packages.
    22. Now run the following commands:
    23. C:\Projects\caffe> python
      >>> import caffe
    24. You should be able to successfully import and run pycaffe.
    25. Matcaffe instructions:

    26. Copy caffe_.mexw64 from C:\Projects\caffe\matlab\+caffe\private\Release\ to C:\Projects\caffe\matlab\+caffe\private
    27. Add C:\Projects\caffe\build\libraries to Matlab Path using setenv() command.
    28. Now you should be able to run demo.m in C:\Projects\caffe\matlab\demo folder.

    No comments:

    Post a Comment

    How to run R code in Python

    R is freely available language and computational tool which is very popular among the statisticians and bioinformatics community. In this p...