Shizhan Zhu
Released on July 25, 2015
This is the implementation of Shizhan Zhu et al.'s CVPR-15 work Face Alignment by Coarse-to-Fine Shape Searching. It is open source under BSD-3 license (see the LICENSE
file). Codes can be used freely only for academic purpose. If you want to apply it to industrial products, please send an email to Shizhan Zhu at zhshzhutah2@gmail.com
first.
If you use the codes as part of your research project, please cite our work as follows:
@inproceedings{zhu2015face,
title={Face Alignment by Coarse-to-Fine Shape Searching},
author={Zhu, Shizhan and Li, Cheng and Loy, Chen Change and Tang, Xiaoou},
booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
pages={4998--5006},
year={2015}
}
- Function getTransViaMerge has been updated to fix the prompting error
length(T) must be the same as size(oldPose,1)!
. For more details about the reason, please refer to the content of Issue #01. Here we would like to express our sincere thanks to maxpy for providing precious discovery and suggestion to the problem.
Due to license issues, this implementation uses two publicly avaiable software packages as opposed to our original implementation:
- VLFeat
- LibSVM. Our implementation has been validated on vlfeat 0.9.20 and libSVM 3.20, with Matlab version R2013a (Unix).
- Put all the required dependency packages under the
external
folder. Matlab compatible bainary files must exist. Please note we have putvl_sift_toosimple.c
in thecodes_released/feat/SIFT
folder. Please put it into the directory ofexternal/vlfeat-0.x.xx/toolbox/sift
before compiling (and hence its relative Matlab compatible binary file would appear after compiling). This would slightly speed up sift extraction. - Put all the 3148 (for training) + 689 (for testing) images in the
imageSource
folder. All images could be downloaded at IBUG page. Only LFPW, Helen, AFW and IBUG set are required. Please change one of the filename in IBUG set fromimage_092⋅_01.jpg
toimage_092_01.jpg
to avoid space in file name.
To train the model using the default setting, simply use the following command:
>> getParametricModels; addAll; learnCFSS;
Model files would be expected to appear in the model
folder.
To do testing, simply use the following command:
>> inferenceCFSS;
After testing, the variable estimatedPose
would exist in the workspace, which is our final estimated facial shape.
A pre-trained model can be downloaded from here. Extract the three model files and put them into the model
folder and run the inference script. Be reminded that all functions path should be included.
With following two simple configuraton changes (you can do it in addAll.m
), our codes can degenerate to SDM. Users can observe results difference especially in the cases where large head pose or extreme expression (e.g. large mouth) exihibits.
config.stageTot = 1;
config.regs.iterTot = 4;
Shape is represented as a 2n dimensional vector each in the format of [x1,x2,...,xn,y1,y2,...,yn]
. Format of bounding box is [left, right, top, bottom]
.
We have uploaded our demo video in youtube. The trained model should perform with similar accuracy as shown in the demo video. Otherwise, the software might have been used in an inappropriate way.
We need to point out again, in this implementation, we can only use the publicly available packages VLFeat and LibSVM due to open source license issues. If you want a faster performance, you need to pay attention to some details like integral map sharing tricks. Classifiers should also be replaced by much faster ones like linear kernel.
- Training typically requests at least 20 GB of memory (based on the default parameters settings). Training codes are implemented with parallel machenism and a multicore CPU + parpool enabled Matlab environment can significantly reduce the training time.
- If you use the codes to train on another dataset, the bounding box given in the testing phase should be equally noisy with that in the training phase. According to our experience, the definition of equally noisy indicates: 1) no bias; and 2) equal variance. Bounding box variance larger than 1/3 of face size is regarded as very noisy. Under such circumstances, please consider to increase the searching stages into 4 stages if possible. Parameters should be tuned to align the dataset size and landmarks protocol via cross-validation.
Suggestions and opinions of this work (both positive and negative) are greatly welcome. Please contact the author by sending email to zhshzhutah2@gmail.com
.
-
Why does the function
svmtrain
orsvmpredict
prompt errors?Please note Matlab itself contains such two functions, and their interface is slightly different from those in libSVM. Please make sure you have included the path to libSVM.
BSD-3, see LICENSE
file for details.