sabato 4 marzo 2017

Install caffe and caffe for matlab on windows 10 for deep learning

ok, not so straightforward...

March, 2017

This brief tutorial helps you to successfully install Caffe on Windows OS and to run the MatLab wrapper on your machine.
Caffe is a very useftul deep learning framework http://caffe.berkeleyvision.org/
I used it to build a LSTM system, cutting the net to a specific layer.

1. First

Refer to this webpage, as noticed by the official webpage of the caffe project:
https://github.com/BVLC/caffe/tree/windows

2. Install pre-requisites

But, if you are a developer, or a dev-geek you have all the software into the checklist, and here you cannot find any suggestion about them:

  • Git!! 
  • Cmake, same as git, you got it previously.
  • Python, 2.X or 3.X or Anaconda, Miniconda etc. 
  • MatLab
  • Cuda and cuDnn

  • MSVC 13 or 15, ok, maybe this is not your IDE for C++, so install it!


3. Follow the instruction on the readme of the caffe windows

Care about the build_win configuration file. There you have to modify the flags with your preference about your personal installation. To install caffe on MatLab enable the correct flag.
if NOT DEFINED BUILD_MATLAB set BUILD_MATLAB=1

4. How to allow caffe working in MatLab

After the installation process (inside the MSVC build the project INSTALL of the caffe solution)
you can try to run the demo on the caffe folders, you could encounter this issue: MatLab does not recognize and accept folder name +caffe.
Copy all the DLLs and other compiled-linekd files from the build caffe folder where you have the mex caffe file.
To solve it you could make a new folder matcaffe, creating a copy of +caffe and renaming it.
When you add the folder to MatLab path using addpath link to the matcaffe folder.
However, internally MatLab use the +caffe folder.