Coder Social home page Coder Social logo

codemakerrr / face_attribute_attack Goto Github PK

View Code? Open in Web Editor NEW

This project forked from koushiksrivats/face_attribute_attack

0.0 0.0 0.0 42.57 MB

Official implementation of the paper "Evading Forensic Classifiers with Attribute-Conditioned Adversarial Faces" (CVPR 23)

Home Page: https://koushiksrivats.github.io/face_attribute_attack/

Python 100.00%

face_attribute_attack's Introduction

Evading Forensic Classifiers with Attribute-Conditioned Adversarial Faces [CVPR 2023]

Fahad Shamshad, Koushik Srivatsan, Karthik Nandakumar
MBZUAI, UAE.


Updates ๐Ÿ“ข

  • 28-07-2023: Code released.


Attribute-conditioned adversarial face image generation

Intructions for Code usage

Setup

  • Get code
git clone https://github.com/koushiksrivats/face_attribute_attack.git
  • Build environment
cd face_attribute_attack
# use anaconda to build environment 
conda create -n faa python=3.8
conda activate faa
# install packages
pip install -r requirements.txt

Dataset and pre-trained weights

  1. Download the forensic classifier training data:
    • You can download the real FFHQ images here
    • You can download the fake (styleGAN generated) FFHQ images here
    • Re-arrange them into the following folder structure.
      data
        |__ train
                |__ fake
                |__ real
        |__ test
                |__ fake
                |__ real
      
  2. Download the pre-trained StyleGAN2 weights:
    • Download the pre-trained StyleGAN2 weights from here.
    • Place the weights in the 'pretrained_models' folder.

Usage

Train forensic classifier

python classifier_training.py \
  --train_data data/train \
  --test_data data/test \
  --batch_size 128 \
  --epochs 10 \
  --classifier_name resnet50 \
  --output_path forensic_classifier_trained_models/resnet50/ \
  --wandb_project_name project_name \
  --experiment_name resnet50_forensic_classifier \
  --resume_training False

# Note: The trained model will be saved in the output_path under the name 'best_epoch.pt' 

Adversarial faces with text as reference

python text_as_reference.py --config_file configs/config_text_as_reference.ini

Adversarial transferability with meta-optimization (Uses the text-as-reference method)

python adversarial_transferability.py --config_file configs/config_adversarial_transferrability.ini

If you're using this work in your research or applications, please cite using this BibTeX:

@inproceedings{shamshad2023evading,
  title={Evading Forensic Classifiers With Attribute-Conditioned Adversarial Faces},
  author={Shamshad, Fahad and Srivatsan, Koushik and Nandakumar, Karthik},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={16469--16478},
  year={2023}
}

face_attribute_attack's People

Contributors

koushiksrivats avatar fahadshamshad avatar

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.