Skip to content

sudban3089/FaceCloak

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FaceCloak

Overview

Generative models can reconstruct face images from encoded representations (templates) bearing remarkable likeness to the original face raising security and privacy concerns. We present FaceCloak, a neural network framework that protects face templates by generating smart, renewable binary cloaks. Our method proactively thwarts inversion attacks by cloaking face templates with unique disruptors synthesized from a single face template on the fly while provably retaining biometric utility and unlinkability. Our cloaked templates can suppress sensitive attributes while generalizing to novel feature extraction schemes and outperforms leading baselines in terms of biometric matching and resiliency to reconstruction attacks. FaceCloak-based matching is extremely fast (inference time cost=0.28ms) and light-weight (0.57MB). Refer to our paper: FaceCloak

Implementation

Creating FaceCloaks

Run scripts/FaceCloak.py with the following arguments. Please check the script for details.

folder_path = '/path/to/synthetictemplates'

gallery_path = str(sys.argv[1]) # filename1 from cfpfp_pair.txt or lfw_pair.txt
probe_path = str(sys.argv[2]) # filename2 from cfpfp_pair.txt or lfw_pair.txt
results_path = str(sys.argv[3]) # path to save results

num_epochs = int(sys.argv[4]) # default = 100 
num_featureaug = int(sys.argv[5]) # default = 50 (so total 101 (=2 * 50 disruptors +1 unprotected template))
bit_size = int(sys.argv[6]) # default = 64
margin = float(sys.argv[7]) # default = 9.0

dataset_name = str(sys.argv[8) # default = 'lfw' Options: ['lfw', 'cfpfp']

We run the experiments on CFPFP and LFW datasets. Ensure the images are in your working directory and please follow the instructions included as comments in the script. In order to be able to run FaceCloak.py, please make sure to extract the face templates first using either one of three temaplte extractors below:

  • InsightFace ArcFace --> scripts/ExtractTemplate.py
  • FaceNet512 --> scripts/ExtractTemplate_FaceNet512.py
  • ArcFaceOPL --> scripts/ExtractTemplate_ArcFaceOPL.py (Refer to ArcFace-OPL below for details)

Synthetic Face for Negative Disruptors

We use StyleGAN3 with truncation_factor=0.7 for generating synthetic faces to be used as disruptor templates. Check out the gen_images.py script from the official repository. (Link)

ArcFace-OPL

This is only for generalizability test. We use VGGFace dataset provided by InsightFace code repo for training ArcFace with Orthogonal Projection Loss. We provide pretrained model in this link. Kindly follow the insructions from the official InsightFace library to download insightface and put model.pt under models_zoo folder before extracting face templates using scripts/ExtractTemplate_ArcFaceOPL.py. Link

Note ExtractTemplate_ArcFaceOPL.py is adapted from inference.py Set arguments --network r50 --weight fullpath-to-model_zoo/model.pt --img -path-to-image

Evaluating Template Protection Scheme

Run scripts/FaceCloak_BiometricMatching.py for evaluating biometric performance, scripts/FaceCloak_Irreversibility.py for irreversibility evaluation and scripts/FaceCloak_Unlinkability.py for unlinkability evaluation. Note FaceCloak is trained everytime differently, so, repeat the experiments to compute and report the average performance which may slightly differ from the paper.

Demographic Attribute Protection

Run scripts/GenderPrediction.py to evaluate the gender prediction results. We have provided the ground truth geneder labels extracted from LFW.py using DeepFace.analyze in data/LFW_Gender.csv.

Visualizing positive and negative disruptors

Run scripts/Arc2Face_Disruptor.py to visualize the face images corresponding to the disruptors created using scripts/FaceCloak.py. This is borrowed from Arc2Face github repo. Please follow their installation instructions.

Acknowledgment

If you find this work to be useful, please cite

@article{banerjee2025facecloaklearningprotectface,
      title={FaceCloak: Learning to Protect Face Templates}, 
      author={Sudipta Banerjee and Anubhav Jain and Chinmay Hegde and Nasir Memon},
      year={2025},
      journal={IEEE International Conference on Automatic Face and Gesture Recognition (FG)},
      note={Accepted}
}

About

Protecting Against Face Template Inversion Attacks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages