The Matlab implementation of Supervised Descent Method (SDM) for Face Alignment.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Matlab Implementation of Supervised Descent Method

A simple Matlab implementation of Supervised Descent Method (SDM) for Face Alignment.

I provide both training and testing modules and one trained model of LFPW subset of 300-W dataset.

You can find the ogirinal paper of my implementation:

Xiong et F. De la Torre, Supervised Descent Method and its Applications to Face Alignment, CVPR 2013.



Datasets in use:


How to use:

  1. Download 300-W data (i.e. LFPW) from above link and put into "./data" folder, then correct the dataset path to your dataset foler in setup.m

    mkdir -p data

    For example:

    options.trainingImageDataPath = './data/lfpw/trainset/';

    options.trainingTruthDataPath = './data/lfpw/trainset/';

    options.testingImageDataPath = './data/lfpw/testset/';

    options.testingTruthDataPath = './data/lfpw/testset/';

  2. Download and install dependencies: libLinear, Vlfeat, mexopencv, put into "./lib" folder and compile if necessary. Make sure you already addpath(...) all folders in matlab. Check and correct the library path in setup.m.

    mkdir -p lib


    • Open Matlab
    • Go to i.e. lib/liblinear-1.96/matlab/ in Matlab editor.
    • Run make.m to comile *.mex files.


    • cd lib/vlfeat/ && make

    • cd ./toolbox in Matlab editor.
    • Run vl_setup
    • Compile mex Hog functions:

      cd misc mex -L../../bin/glnx86 -lvl -I../ -I../../ vl_hog.c

    • Setup path.
    • Assume that your located at: <vlfeat_folder>/bin/glnx86 Create soft link:

      ln -s <vlfeat_folder>/bin/glnx86/ /usr/local/ Check if the is ready to use. ldd vl_hog.mexglx If still not found. Add /usr/local/lib into /etc/ (sudo). sudo ldconfig ldconfig -p | grep Check again: >> ldd vl_hog.mexglx

  3. If you run first time. You should set these following parameters to learn shape and variation. For later time, reset to 0.

    options.learningShape = 1; options.learningVariation = 1;

  4. Do training:


  5. Do testing:


Note: in the program, we provide training models of LFPW (68 landmarks) in folder: "./model". The program does not optimize speed and memory during training, the memory problem may happens if you train on too much data.