Skip to main content

Accumulate depth frames of 3DMAD database for better face models and analyze verification and spoofing performances of 2D, 2.5D and 3D samples

Project description

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 paper Spoofing 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:

  1. The original paper with the baseline verification and counter-measure algorithms explained in details:

    ==TO BE UPDATED==
  2. 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 data

The data used in the paper is publicly available and should be downloaded and installed prior to try using the programs described in this package. Visit the 3D MASK ATTACK database portal for more information.

Installation

There are 2 options you can follow to get this package installed and operational on your computer: you can use automatic installers like pip (or easy_install) or manually download, unpack and use zc.buildout to create a virtual work environment just for this package.

Using an automatic installer

Using pip is the easiest (shell commands are marked with a $ signal):

$ pip install maskattack.study

You can also do the same with easy_install:

$ easy_install maskattack.study

This 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 by virtualenv or if you have root access to your machine. Otherwise, we recommend you use the next option.

Using zc.buildout

Download the latest version of this package from PyPI and unpack it in your working area. The installation of the toolkit itself uses buildout. 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/buildout

These 2 commands should download and install all non-installed dependencies and get you a fully operational test and development environment.

User Guide

This 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 the buildout command, you should have all required utilities sitting inside the bin directory. We expect that the data files of the database are installed in a sub-directory called database at 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 database

If you don’t want to create a link, use the --inputdir flag (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 files

The 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.py

This 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.py

This 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 --help at 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 experiments

Once 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.py

The 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>_<data type>.

Finally, the plots are generated for each of these experiments via following commands (by default under ./result folder):

$ 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 ICP

To see all the options for these scripts, just type --help at the command line.

Anti-spoofing experiments

Anti-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. -b flag 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> -b

Maatta11 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.py

To see all the options for these scripts, just type --help at the command line.

Problems

In case of problems, please contact any of the authors of the paper.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

maskattack.study-1.0.0.zip (126.0 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page