Coder Social home page Coder Social logo

synthaspoof's Introduction

SynthASpoof


Note

This is the official repository of the work: SynthASpoof: Developing Face Presentation Attack Detection Based on Privacy-friendly Synthetic Data (link)

*** Accepted at CVPR workshops 2023 ***

SynthASpoof dataset

The SynthASpoof is the synthetic-based face presentation attack detection datasets, including synthetic-generated 25,000 bona fide images and 78,800 corresponding attacks collected by presenting the printed/replayed images to capture cameras (one mobile phone, two different tablets, and one webcam).

The dataset can be downloaded via Google Drive (please share your name, affiliation, and official email in the request form).

The image samples in SynthASpoof are shown: grafik

NOTE: Please note that the SynthASpoof data aims at being a development (training) data for face PAD. All the evalution are conducted on the authentic data to real-world scenarios.

Data preparation

SynthASpoof dataset: the images should be preprocessed including face detection and crop via data_preprocess/crop_face.py before training.

Test real datasets: for testing, we use four real face PAD dataset, MSU-MFSD, CASIA-FAS, Idiap ReplayAttack, and OULU-NPU. The data format in the real face PAD datasets are videos. We sampled 25 frames in the average time interval of each video.

Then, CSV files are generated for each dataset for further training and evaluation. The format of the dataset CSV file is:

image_path,label
/image_dir/image_file_1.png, bonafide
/image_dir/image_file_2.png, bonafide
/image_dir/image_file_3.png, attack
/image_dir/image_file_4.png, attack

Training

Example of training:

python train.py \
  --csv_1 'SynthASpoof_data.csv' \
  --csv_2  'RealPAD_data.csv' 

The loss is computed based on csv_1. csv_2 is used for style transfer.

Testing

Example of testing:

python train.py \
  --test_csv 'test_data.csv' \
  --model_path 'model.pth'

where test_data.csv contains image path and the corresponding label (bonafide or attack).

Models

The models trained on SynthASpoof with MixStyle can be downloaded via owncloud.

if you use SynthASpoof dataset in this repository, please cite the following paper:

@misc{synthaspoof,
  doi = {10.48550/ARXIV.2303.02660},
  url = {https://arxiv.org/abs/2303.02660},
  author = {Fang, Meiling and Huber, Marco and Damer, Naser},
  title = {SynthASpoof: Developing Face Presentation Attack Detection Based on Privacy-friendly Synthetic Data},
  publisher = {arXiv},
  year = {2023},
  copyright = {Creative Commons Attribution Non Commercial Share Alike 4.0 International}
}

License

The dataset, the implementation, or trained models, use is restricted to research purpuses. The use of the dataset or the implementation/trained models for product development or product competetions (incl. NIST FRVT MORPH) is not allowed. This project is licensed under the terms of the Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license. Copyright (c) 2020 Fraunhofer Institute for Computer Graphics Research IGD Darmstadt.

synthaspoof's People

Contributors

meilfang avatar

Stargazers

Nidheesh Gorthi avatar Mirza Mohtashim Alam avatar Aayush avatar  avatar joe avatar Yanwei Liu avatar lizhongguo avatar  avatar WangDong avatar Rscryz avatar Hazqeel Afyq avatar Maxim Melichov avatar  avatar Umit Kacar, PhD avatar  avatar Aleksandr Pikul avatar Tobias Zillig avatar Minh Nguyen Hoang avatar Unai avatar Luis Unzueta avatar Zhang Zhiteng avatar  avatar  avatar Jana Jovičić avatar Davor Jordacevic avatar Fadi Boutros avatar Richard Chen avatar  avatar Yuankun Xie avatar  avatar Marco Huber avatar  avatar

Watchers

 avatar

synthaspoof's Issues

ValueError: All-NaN slice encountered

On running the test script as per the format provided in the README:
python test.py \ --test_csv 'test_data.csv' \ --model_path 'model.pth'

I'm getting the error message:
np.abs(differ_tpr_fpr_1) [nan nan nan nan nan nan nan nan nan] Traceback (most recent call last): File "C:\Users\ssais\Documents\AntiSpoofing_Githubrepos\SynthASpoof\test.py", line 94, in <module> main(test_csv=args.test_csv, args=args) File "C:\Users\ssais\Documents\AntiSpoofing_Githubrepos\SynthASpoof\test.py", line 29, in main AUC, HTER = test_model(model, test_loader) File "C:\Users\ssais\Documents\AntiSpoofing_Githubrepos\SynthASpoof\test.py", line 62, in test_model AUC, _, _, HTER = performances_cross_db(raw_test_scores, gt_labels) File "C:\Users\ssais\Documents\AntiSpoofing_Githubrepos\SynthASpoof\utils.py", line 75, in performances_cross_db et_err_threhold_cross_db right_index = np.nanargmin(np.abs(differ_tpr_fpr_1)) File "C:\Users\ssais\Documents\AntiSpoofing_Githubrepos\SynthASpoof\env\lib\site-packages\numpy\lib\nanfunctions.py", line 552, in nanargmin raise ValueError("All-NaN slice encountered") ValueError: All-NaN slice encountered
The issue seems to be with the fact that either fpr or tpr is a list with all-Nan values, due to which the values of np.abs(differ_tpr_fpr_1) is [nan nan nan nan nan nan nan nan nan] (I printed it out as a debugging measure). Please do provide the solution to this issue.

NameError: name 'test_model' is not defined.

When running test.py script, I get the error on line 29: "NameError: name 'test_model' is not defined. Did you mean: 'test_loader'?"
Am I missing something or is the definition of the test_model missing?

3 images are missing from Google Drive

Hi! I have found that there's 1 missing image in Samsung_ReplayAttack and 2 ones in iPad_ReplayAttack directories.
Could you add them to Google drive, please?

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.