Skip to content

FusionBrainLab/AdversarialFaces

Repository files navigation

This repository contains the code and experiments for the paper:

"Inverting Black-Box Face Recognition Systems via Zero-Order Optimization in Eigenface Space"

🔧 How to Use

📁 Datasets

  • LFW
    Download lfw.tgz and place it into the data/ directory.

  • AgeDB-30
    No manual setup required — the script will automatically download and extract it.

  • CFP-FP
    Download cfp-dataset.zip and place it into the data/ directory.


🧠 Models

🚀 Running the Full Pipeline

  1. Step 1: Prepare datasets and evaluate on original images

    bash scripts/download_preprocess_eval_on_original_sets.sh
    • Unpacks datasets
    • Aligns all faces (MTCNN / RetinaFace)
    • Runs baselines with ArcFace and FaceNet on original (real) images
  2. Step 2: Reconstruct positive 1st faces in positive pairs with our method

    bash scripts/reconstruct_faces.sh
    • It takes ~30 hours on 4×A100 GPUs to run
    • Runs our zero-order optimization algorithm
    • Restores the first face in all positive verification pairs
    • Supports ArcFace-based and FaceNet-based reconstructions
  3. Step 3: Evaluate reconstructed faces

    bash scripts/run_eval_on_reconstructed.sh
    • Aligns reconstructed images (MTCNN / RetinaFace)
    • Runs ArcFace and FaceNet verification on restored faces

📝 Results are saved into:

runs/results.txt

⚙️ Optional: Generate Your Own PCA Basis

If you prefer to generate your own PCA eigenfaces instead of using the precomputed ones, run the following script:

python algorithms/generate_pca_basis.py

You need to specify the path to a folder with face images. We used the FFHQ thumbnails dataset (thumbnails128x128 version).

The script will save:

  • A mean face vector mtcnn_crops_ffhq_average_vector_square.pt
  • A PCA projection matrix eigenvectors_denormalized_Square_ffhq.pt (eigenfaces)

Make sure to copy the generated files to the models/ folder so that reconstruction scripts can find them.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •