Giter Club home page Giter Club logo

multi-domain-learning-fas's Introduction

Multi-domain Learning for Updating Face Anti-spoofing Models

drawing

This project page contains Spoof in Wild with Multiple Attacks Version 2 (SiW-Mv2) dataset and the official implementation of our ECCV2022 oral paper "Multi-domain Learning for Updating Face Anti-spoofing Models". [Arxiv] [SiW-Mv2 Dataset]

Our algorithm has been officially accepted and delivered to the IAPRA ODIN program!

Authors: Xiao Guo, Yaojie Liu, Anil Jain, Xiaoming Liu

Introduction: SiW-Mv2 Dataset is a large-scale face anti-spoofing dataset that includes $14$ spoof attack types, and these spoof attack types are designated and verified by the IARPA ODIN program. In addition, ALL live subjects in SiW-Mv2 dataset participate in person during the dataset collection, and they have signed the consent form which ensures the dataset usage for the research purpose. The more details are can be found in dataset.

1. Setup the environment.

  • The quick view on the code structure:
./source_SiW_Mv2
    ├── config_siwm.py 
    ├── train.py
    ├── test.py
    ├── run.sh (call train.py and test.py)
    ├── inference.py
    ├── inference.sh (call inference.py for the custom data.)
    ├── csv_parser.py   
    ├── csv_parser.sh (call csv_parser.py to reproduce the numerical baseline result.)
    ├── pro_3_text (text file for the protocol III)
    │      └── ...
    ├── model.py (SRENet)
    ├── preprocessing.py (data preprocessing file.)
    ├── demo (the demo image and image dir for the quick usage)
    │      └── ...
    ├── parameters.py
    ├── enviornment.yml
    ├── metrics.py
    ├── utils.py
    ├── warp.py
    └── DRA_form_SIWMv2.pdf (Dataset Release Agreement)
  • To create your own environment by:
    conda env create -f environment.yml
    

2. Quick Usage

  • The pre-trained weights for $3$ different protocols and corresponding .csv result files can be found in this page.

  • To reproduce the numerical results of the baseline, please run the following command. Result will output to the screen.

bash csv_parser.sh
Compute the protocol I scores.
AP:  ['2.3', '2.3', '0.4', '2.3', '0.0', '7.3', '5.4', '0.0', '10.7', '0.0', ...
...
  • For inference on a single image or a directory of images, please run the following command. Of course, users can play around with their own images.

  • Results will output to the screen and saved into the .csv file.

bash inference.sh
...
- Results written to ./result/result.csv
...
./demo/1.png is classified as Spoof with the score 0.52

3. Train and Testing

drawing drawing

  • We provide detailed dataset preprocessing steps as well as the training scripts.
  • After following our instructions, user can generate tensorboard similar to the left figure above, and the intermediate results (right figure above) which has, from the top to down, original input image, pseudo reconstructed live images, spoof trace, ground truth and predicted depth maps.

3.1. Data Preparation

  • Please first sign the DRA form before donwloading the SiW-Mv2 dataset.
  • To preprocess the videos for training and testing, you can adapt our preprocessing.py for your own data configuration, such as:
python preprocessing.py
  • After the preprocessing step completes, the program outputs extracted frames (*.png) and facial landmarks (*.npy) to data folder. Specifically,
./preprocessed_image_train
    ├── Train
    │     │── live
    │     │     │── Live_0
    │     │     │     │── 1.png
    │     │     │     │── 1.npy
    │     │     │     │── 2.png
    │     │     │     │── 2.npy
    │     │     │     └── ...
    │     │     │── Live_1
    │     │     │     │── 1.png
    │     │     │     │── 1.npy
    │     │     │     └── ...
    │     │     ...
    │     └── spoof
    │           │── Spoof_0
    │           │     │── 1.png
    │           │     │── 1.npy
    │           │     └── ...
    │           │── Spoof_1
    │           │     │── 1.png
    │           │     │── 1.npy
    │           │     └── ...
    │           ...
    └── Test (consistent with the training dataset configuration)
          │── live
          │     │── Live_0
          │     │     └── ...
          │     ...
          └── spoof
                │── Spoof_0
                │     └── ...
                ...

3.2. Train and Testing

  • After setting up the dataset path, you can run the training code as shown below:
    python train_architecture.py --pro=1 --cuda=0
  • To run the testing code, which will save scores in csv file.
    python test_architecture.py --pro=1 --cuda=0
  • To run the algorithm for all $3$ protocols, please run the following code.
    bash run.sh

Reference

If you would like to use our work, please cite:

@inproceedings{xiaoguo2022MDFAS,
    title={Multi-domain Learning for Updating Face Anti-spoofing Models},
    author={Guo, Xiao and Liu, Yaojie and Jain, Anil and Liu, Xiaoming},
    booktitle={ECCV},
    year={2022}
}

This github will continue to update in the near future. If you have any question, please contact: Xiao Guo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.