Training FASNet for face PAD

This section describes running our implementation of FASNet on WMCA dataset. It is strongly recommended to check the publication for better understanding of the described work-flow.

Preprocessing

FASNet accepts RGB images only, hence the preprocesing is done first. This can be done as follows.

./bin/spoof.py \
wmca-color \
fasnet \
--execute-only preprocessing \
--sub-directory <FASNET_PIPELINE_FOLDER>
--grid idiap

After this stage, the preprocessed files will be available in <PIPELINE_FOLDER> /preprocessed/, which is notated from here onwards as <FASNET_PREPROCESSED_FOLDER>.

Training FASNET

Once the preprocessing is done, the next step is to train the FASNET architecture. A config file is defined which can define the transforms, image resolution, training parameters such as number of epochs, learning rate and so on.

Once the config file is defined, training the network can be done with the following code:

./bin/train_fasnet.py \                   # script used for FASNET training
<PATH_TO_TRAINER_CONFIG>/wmca_faset.py \  # configuration file defining the FASNET network, database, and training parameters
-vv                                      # set verbosity level

People in Idiap can benefit from GPU cluster, running the training as follows:

jman submit --queue gpu \                      # submit to GPU queue (Idiap only)
--name <NAME_OF_EXPERIMENT> \                  # define the name of th job (Idiap only)
--log-dir <FOLDER_TO_SAVE_THE_RESULTS>/logs/ \ # substitute the path to save the logs to (Idiap only)
--environment="PYTHONUNBUFFERED=1" -- \        #
./bin/train_fasnet.py \                        # script used for FASNET training
<PATH_TO_TRAINER_CONFIG>/wmca_fasnet.py \      # configuration file defining the FASNET network, database, and training parameters
--use-gpu \                                    # enable the GPU mode
-vv                                            # set verbosity level

For a more detailed documentation of functionality available in the training script, run the following command:

./bin/train_fasnet.py --help   # note: remove ./bin/ if buildout is not used

Please inspect the corresponding configuration file, wmca_faset.py for example, for more details on how to define the database, network architecture and training parameters.

The protocols, and channels used in the experiments can be easily configured in the configuration file.

Running experiments with the trained model

The trained model file can be used with FASNetExtractor to run PAD experiments with spoof.py script. A dummy algorithm is added to forward the scalar values computed as the final scores.

For grandtest protocol this can be done as follows.

./bin/spoof.py \
wmca-color \
fasnet \
--protocol grandtest \
--sub-directory <FOLDER_TO_SAVE_FASNET_RESULTS>  -vv

Evaluating results

To evaluate the models run the following command.

./bin/scoring.py -df \
<FOLDER_TO_SAVE_FASNET_RESULTS>/grandtest/scores/scores-dev -ef \
<FOLDER_TO_SAVE_FASNET_RESULTS>/grandtest/scores/scores-eval