Package: maskattack.study
This package implements the baseline verification algorithms and LBP-based counter-measures against spoofing attacks with 3d masks to 2D, 2.5D and 3D face recognition systems as described in the paperSpoofing Face Recognition with 3D Masks, by N. Erdogmus and S. Marcel.If you use this package and/or its results, please cite the following publications:The original paper with the baseline verification and counter-measure algorithms explained in details:==TO BE UPDATED==Bob as the core framework used to run the experiments:@inproceedings{Anjos_ACMMM_2012,
    author = {A. Anjos AND L. El Shafey AND R. Wallace AND M. G\"unther AND C. McCool AND S. Marcel},
    title = {Bob: a free signal processing and machine learning toolbox for researchers},
    year = {2012},
    month = oct,
    booktitle = {20th ACM Conference on Multimedia Systems (ACMMM), Nara, Japan},
    publisher = {ACM Press},
}If you wish to report problems or improvements concerning this code, please contact the authors of the above mentioned papers.Raw dataThe data used in the paper is publicly available and should be downloaded and installedpriorto try using the programs described in this package. Visitthe 3D MASK ATTACK database portalfor more information.InstallationNoteIf you are reading this page through our GitHub portal and not through PyPI, notethe development tip of the package may not be stableor become unstable in a matter of moments.Go tohttp://pypi.python.org/pypi/maskattack.studyto download the latest stable version of this package.There are 2 options you can follow to get this package installed and operational on your computer: you can use automatic installers likepip(oreasy_install) or manually download, unpack and usezc.buildoutto create a virtual work environment just for this package.Using an automatic installerUsingpipis the easiest (shell commands are marked with a$signal):$ pip install maskattack.studyYou can also do the same witheasy_install:$ easy_install maskattack.studyThis will download and install this package plus any other required dependencies. It will also verify if the version of Bob you have installed is compatible.This scheme works well with virtual environments byvirtualenvor if you have root access to your machine. Otherwise, we recommend you use the next option.Usingzc.buildoutDownload the latest version of this package fromPyPIand unpack it in your working area. The installation of the toolkit itself usesbuildout. You don’t need to understand its inner workings to use this package. Here is a recipe to get you started:$ python bootstrap.py
$ ./bin/buildoutThese 2 commands should download and install all non-installed dependencies and get you a fully operational test and development environment.NoteThe python shell used in the first line of the previous command set determines the python interpreter that will be used for all scripts developed inside this package. Because this package makes use ofBob, you must make sure that thebootstrap.pyscript is called with thesameinterpreter used to build Bob, or unexpected problems might occur.If Bob is installed by the administrator of your system, it is safe to consider it uses the default python interpreter. In this case, the above 3 command lines should work as expected. If you have Bob installed somewhere else on a private directory, edit the filebuildout.cfgbeforerunning./bin/buildout. Find the section namedexternaland edit the lineegg-directoriesto point to thelibdirectory of the Bob installation you want to use. For example:[external]
recipe = xbob.buildout:external
egg-directories=/Users/crazyfox/work/bob/build/libUser GuideThis section explains how to use the package in order to: a) accumulate depth frames in the 3DMAD database in order to obtain better 3D face models; b) analyze each mask in the 3DMAD database with 2 different algorithms for each of the 2D, 2.5D and 3D modes; c) test LBP-based anti-spoofing algorithms using 3 different classifiers: Chi-2, Linear Discriminant Analysis (LDA) and Support Vector Machines (SVM).It is assumed you have followed the installation instructions for the package, and got the required database downloaded and uncompressed in a directory. After running thebuildoutcommand, you should have all required utilities sitting inside thebindirectory. We expect that the data files of the database are installed in a sub-directory calleddatabaseat the root of the package. You can use a link to the location of the database files, if you don’t want to have the database installed on the root of this package:$ ln -s /path/where/you/installed/the/database databaseIf you don’t want to create a link, use the--inputdirflag (available in all the scripts) to specify the root directory containing the database files.Accumulate depth frames and generate pre-processed 2D, 2.5D and 3D filesThe first stage of the process is accumulating depth frames for each Kinect video. 30 frames are aligned and accumulated for each 3D model, resulting in 10 models per video (HDF5 file).Firstly, the depth values in depth frames have to be projected to their real world coordinates by running the following command:$ bin/rgbd_to_rgbxyz.py -i <database directory>This creates a subfolder in the output directiory (By default./output/aligned) and saves there the aligned coordinates of all frames in HDF5 files.Next, the aligned frames are accumulated via the following command:$ bin/rgbxyz_to_accumulated.pyThis creates a subfolder in the output directiory (By default./output/accumulated) and saves there the accumulated models as HDF5 files (10 models per one video in the database). The contents of this folder are the 3D data to be used in baseline verification experiments.In order to generate depth maps from the accumulated models, run the following command:$ bin/accumulated_to_depth.pyThis creates a subfolder in the output directiory (By default./output/depth) and saves there the depth maps obtained from the accumulated models. The contents of this folder are the 2.5D data to be used in baseline verification and anti-spoofing experiments.Finally, the corresponding grayscale images are created, by taking every 30th frame of each video in the database:$ bin/hdf5_to_grayscale.py -i <database directory>This creates a subfolder in the output directiory (By default./output/grayscale) and saves there the grayscale images obtained from the video files in the database. The contents of this folder are the 2D data to be used in baseline verification and anti-spoofing experiments.To see all the options for these scripts, just type--helpat the command line.You can also view the accumulated models using:$ bin/view_accumulated.py <path to the accumulated HSF5 file>Analyzing facial masks in 3DMAD via baseline verification experimentsOnce the experiments files for 2D, 2.5D and 3D modes are generated, you can run the baseline verification algorithms which analyze each mask in the database in a leave-one-out manner.For LBP-2D, LBP-2.5D, TPS-3D, ISV-2D, ISV-2.5D and ICP-3D methods, the following commands should be used in their respective order:$ bin/analyzeLBP.py
$ bin/analyzeLBP.py -t depth
$ bin/analyzeTPS.py
$ bin/analyzeISV.py
$ bin/analyzeISV.py -t depth
$ bin/analyzeICP.pyThe LBP, TPS and ISV algorithms save the extracted features in subfolders, by default under./feature/<algorithm>. The obtained scores are saved into subfolders by default under./result/<algorithm>_<datatype>.Finally, the plots are generated for each of these experiments via following commands (by default under./resultfolder):$ bin/analyze_plot.py
$ bin/analyze_plot.py -t depth
$ bin/analyze_plot.py -a TPS
$ bin/analyze_plot.py -a ISV
$ bin/analyze_plot.py -a ISV -t depth
$ bin/analyze_plot.py -a ICPTo see all the options for these scripts, just type--helpat the command line.Anti-spoofing experimentsAnti-spoofing experiments with different types of LBP features and classifiers can be run by the following command:$bin/antispoofLBP.py -t <grayscale/depth> -l <regular/transitional/direction-coded/modified/maatta11> -c <chi2/lda/svm>without using blocks.-bflag is used to divide the LBP images into 3x3 blocks and concatahate their histograms:$bin/antispoofLBP.py -t <grayscale/depth> -l <regular/transitional/direction-coded/modified> -c <chi2/lda/svm> -bMaatta11 has its own specific block division.Once all experiments are completed (2x5x3 + 2x4x3 = 54 in total), the bar plot can be obtained via:$ bin/antispoof_plot.pyTo see all the options for these scripts, just type--helpat the command line.ProblemsIn case of problems, please contact any of the authors of the paper.