AdversarialMask
AdversarialMask copied to clipboard
Original PyTorch implementation of the AdversarialMask paper
Adversarial Mask: Real-World Universal Adversarial Attack on Face Recognition Models
This is a PyTorch implementation of Adversarial Mask: Real-World Universal Adversarial Attack on Face Recognition Models by Alon Zolfi, Shai Avidan, Yuval Elovici, Asaf Shabtai. Mask projection code is partially inspired from FaceXZoo.

Face Recognition Models
Please put the downloaded weights in a local directory called "weights" under each model directory (or change location in the config file).
ArcFace and CosFace
Code is taken from here. Download weights from here.
MagFace
Code is taken from here. Download weights from here.
Landmark Detection Models
MobileFaceNet
Code is taken from here. Download weights from here. (Weights file is already included in this repository under landmark_detection/pytorch_face_landmark/weights).
Face Alignment
Code is taken from here. Weights are downloaded automatically on the first run.
Note: this model is more accurate, however, it is a lot larger than MobileFaceNet and requires a large memory GPU to be able to backpropagate when training the adversarial mask.
3D Face Reconstruction Model
Code is taken from here. Download weights from here. (Weights file is already included in this repository under prnet).
Datasets
CASIA-WebFace
The cleaned up version of the dataset can be found here, suggested by this github issue.
Installation
Install the required packages in req.txt.
Usage
Configuration
Configurations can be changed in the config file.
Train
Run the patch/train.py file.
Test
Run the patch/test.py file. Specify the location of the adversarial mask image in main function.
Citation
@inproceedings{zolfi2023adversarial,
title={Adversarial Mask: Real-World Universal Adversarial Attack on Face Recognition Models},
author={Zolfi, Alon and Avidan, Shai and Elovici, Yuval and Shabtai, Asaf},
booktitle={Machine Learning and Knowledge Discovery in Databases: European Conference, ECML PKDD 2022, Grenoble, France, September 19--23, 2022, Proceedings, Part III},
pages={304--320},
year={2023},
organization={Springer}
}