John-niu-07 / advmask

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adversarial Attack on Face

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.

GAN Inversion

With stylegan2-encoder-pytorch: We have a good performance, but cannot manipulation

With idinvert_pytorch: We have a bad performance, but can manipulation (with correct boundary)

DiffPure

purify adv image

DiffusioinCLIP

use it to conduct adv attack with diffusion model

##ddim train our diffusion model on NIO dataset, which can bu used by DiffPure and DiffusionCLIP

Datasets

NIO

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.

About


Languages

Language:Python 98.1%Language:Jupyter Notebook 1.2%Language:Shell 0.4%Language:Cuda 0.2%Language:Dockerfile 0.0%Language:C++ 0.0%Language:Makefile 0.0%Language:Batchfile 0.0%