Skip to content
Snippets Groups Projects

Vulnerability Assessment and Detection of Face Morphing Attacks

This package contains the source code for reproducing the experiments and scores of the paper "Vulnerability Analysis of Face Morphing Attacks from Landmarks and Generative Adversarial Networks".

Installation

This package is part of the signal-processing and machine learning toolbox bob. Install conda before continuing.

Download the source code of this paper and unpack it. Then, you can create and activate the required conda environment with the following commands:

$ cd bob.paper.icassp2021_morph
$ conda env create -f environment.yml -n bob.paper.icassp2021_morph
$ conda activate bob.paper.icassp2021_morph

This will install all the required software to reproduce this paper.

Downloading Datasets

Bona Fide Datasets

Three bona-fide datasets are used in this study which are publicly available. To download the datasets please refer to their websites:

Morphing Attack Datasets

The morphing attacks datasets of the same three datasets are also publicly available:

Configuring Dataset Structure

After downloading the morphing attack datasets, we need all three to be in the same our folder (here called root). The final data structure to be:

+-- root
|   +-- facelab_london
|   |   +-- morph_amsl
|   |   +-- morph_facemorpher
|   |   +-- morph_opencv
|   |   +-- morph_stylegan
|   |   +-- morph_webmorph
|   |   +-- raw
|   +-- feret
|   |   +-- morph_facemorpher
|   |   +-- morph_opencv
|   |   +-- morph_stylegan
|   |   +-- raw
|   +-- frgc
|   |   +-- morph_facemorpher
|   |   +-- morph_opencv
|   |   +-- morph_stylegan
|   |   +-- raw

To replicate this exact structure, closely follow the instructions below:

FERET - Download the script copy_original_feret.py and place it in the <feret directory>, then:

$ cd <feret directory>
$ python copy_original_feret.py /path/to/bonafide/feret/folder

FRGC - Download the script copy_original_frgc.py and place it in the <frgc directory>, then:

$ cd <frgc directory>
$ python copy_original_frgc.py /path/to/bonafide/frgc/folder

These two aforementioned scripts copy the original images used to create the morphs, from the respective bona fide feret and frgc folders, and place them in a new raw folder of the morphing attack datasets as .jpg files.

Face Research London Dataset:

Note: The preprocess.py script included in the FRLL-Morphs dataset is no longer necessary, and thus should NOT be run.

  1. Download and extract only the neutral_front and smiling_front datasets from the Face London Research Dataset
  2. Place them in a new facelab_london/raw folder.
  3. Rename them simply as neutral and smiling respectively.
  4. Remove the .tem files from the neutral folder if not specifically required for any experiments as these could clash with other operations.

Bob Dataset Location

Now, simply set the path for Bob inside the path_to_data.txt file to the absolute path of the folder containing all three datasets (called root in the example above):

[MORPH_DATA_DIRECTORY] = absolute/path/to/the/root/directory/of/all/datasets/

Running Vulnerability Experiments

Make sure to have already activated the correct conda environment:

$ conda activate bob.paper.icassp2021_morph

Make sure to be in the correct path:

$ cd bob/paper/icassp2021_morph

To submit the vulnerability experiments to the grid:

$ config/grid/run_all.sh       # Runs the FERET and FRGC experiments
$ config/grid/run_all_frll.sh  # Runs the FRLL experiments

If you wish to run a subset of experiements (eg only one dataset), you can tune one of the yaml files, e.g. bob/paper/icassp2021_morph/config/permutations.yaml file accordingly, and after making sure to be in the correct path:

$ cd bob/paper/icassp2021_morph
$ config/jgen.sh # or config/jgen_frll.sh
$ config/grid/run_all.sh

If you wish to run a single individual experiment, then run:

$ jman submit -q sgpu -m 22 -n <experiment-name> `which verify.py` config/grid/<script.py> config/<template.py>

By default this submits all the experiments to the q1d --io-big queue with 6 GB memory. Alternatively, if one wishes to run the experiment on sgpu -m 22G queue, then use run_template.sh instead of run_template_q1d.sh, when computing jgen_frll.sh or jgen.sh.

If you wish to simply run an experiment locally:

$ `which verify.py` config/grid/feret-vulnerability-reverse-oneset-facenet-opencv-spoof.py config/facenet.py

All resulting score files will be saved in the default /idiap/user/<name>/scores directory. A specific path can be provided if necessary with --score-directories, or by un-commenting and editing the corresponding line in bob/paper/icassp2021_morph/config/config.py, and then re-running jgen as explained previously.

Contact

For questions or reporting issues to this software package, contact our development mailing list.

Before doing that, check our documentation by clicking in the links on the top.