Matconvnet is a convolutional neural network (CNN) toolbox for Matlab. Being integrated into Matlab it gives you the flexibility to use Matlab built in functions but it's execution time is slightly slower compared to C++ based caffe and other deep learning libraries. In addition, you need Matlab licence to run this library. Similar to other Matlab toolboxes it's relatively easier to compile compared to open source caffe and tensorflow. I have listed the set of instructions to compile MatConvNet on a Windows machine.
Follow step 1 to 5 and enter the following command
After succesfull build you can test the mex files by entering the command below
- Matlab version 2017a
- MatConvNet : http://www.vlfeat.org/matconvnet/, http://www.vlfeat.org/matconvnet/download/matconvnet-1.0-beta24.tar.gz
- Visual Studio 2015: https://www.visualstudio.com/downloads/, https://www.visualstudio.com/vs/older-downloads/
- CUDA 8.0: (For GPU Support only) https://developer.nvidia.com/cuda-downloads
- cuDNN v5.1 (For GPU support only): https://developer.nvidia.com/cudnn
- Extract MatConvNet to a folder.
- Install Visual Studio. Make sure you select the option for programming languages when you install visual studio otherwise Matlab will not be able to find the compiler.
- Run Matlab and setup MatConvnet extracted folder as working directory.
- In command window enter the following command to setup Visual Studio as your compiler
mex MEX configured to use 'Microsoft Visual C++ 2015 Professional' for C++ language compilation.
- Now add path to 'matlab' folder in the extracted library and compile
addpath vl_compilenn( , 1)
- At this point MatConvNet should be succesfully compiled to run on CPU. To test this run the following commands.
- Install CUDA v8.0
- Extract cuDNN
- 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'.
vl_compilenn( , true, , , , , , true, , );
vl_testnn( , true);