Skip to content

fonfonx/FaceRecognition

Repository files navigation

FaceRecognition in real-world images

This is the source code of my article.

Fontaine, X., Achanta, R., & Süsstrunk, S. (2017). Face Recognition in Real-world Images. In IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP) (No. EPFL-CONF-224338).

It is inspired from the RSC algorithm [1].

Installation

  • Install some Python packages:
pip install numpy scipy Pillow l1ls sklearn matplotlib
  • You will need OpenCV for Python. One installation solution is explained in this link with the following cmake command:
cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON  -D WITH_OPENGL=ON -D WITH_VTK=ON -D WITH_GTK=ON -D WITH_CUDA=OFF ..
  • The following dependencies may be missing:
sudo apt-get install libopenblas-dev
  • Download Boost from the Boost official website and go to the boost directory and run the following commands:
./bootstrap.sh --with-libraries=python
./b2
sudo ./b2 install
  • Then download DLIB:
git clone https://github.com/davisking/dlib.git
git checkout tags/v19.0 # current version did not work for me
sudo python setup.py install
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
  • Change the path to haarcascade_frontalface_default.xml and to the shape_predictor_68_face_landmarks.dat file in the config.py file.

Dataset

I used the LFWa version of the LFW dataset in order to be able to compare my results with other algorithms. It can be downloaded with

wget http://www.openu.ac.il/home/hassner/data/lfwa/lfwa.tar.gz
tar xvfz lfwa.tar.gz
cp -R lfw2 <directory-to-store-dataset>/.

Change the path to the lfw2 folder in the config.py file.

Run the Face Recognizer

Run python recognizer.py to run the code of the paper. You can change the parameters (number of training images, etc) in the file config.py. It should be the only file you have to modify.

References

[1] Yang, M., Zhang, L., Yang, J., & Zhang, D. (2011, June). Robust sparse coding for face recognition. In Computer Vision and Pattern Recognition (CVPR), 2011 IEEE Conference on (pp. 625-632). IEEE.