GitHub - Messerblatt/fawkes_web

4 min read Original article ↗

Fawkes Web Interface

A Flask-based web interface for Fawkes, the privacy-preserving tool that protects images against facial recognition systems.

Overview

Demonstrating Fawkes on an Image of Obama

Fawkes is a privacy tool that applies imperceptible modifications to images to protect them against unauthorized facial recognition systems. It "cloaks" faces in images, making them unrecognizable to facial recognition models while remaining visually unchanged to human observers.

This repo contains a web interface for just that, using Flask and gunicorn. The web interface provides an easy-to-use graphical interface for the Fawkes image cloaking system. Upload your images through a simple drag-and-drop interface and apply privacy-preserving modifications to protect against unauthorized facial recognition.

Tested on Python3.8.20 ("Why such old Python version?!" - Because the models that powers Fawkes was trained using tensorflow 2.4.1 back in 2019. Using up-to-date python requires up-to-date tensorflow, which requires a different structure of the underlying .h5 model. I'm about to figure this out)

Pre-Installation

git cloneing this repo requires git lfs (specifically, the .h5 file in ./fawkes/models/ is ~150MB), so make sure to sudo apt install git-lfs and verify installation success.

1. Clone this repository

With git lfs installed, do the usual:

git clone https://github.com/Messerblatt/fawkes_web
cd fawkes_web

2. Install Python dependencies

pip install -r requirements.txt

Keep in mind: Using a virtual environment is strongly advised.

3. Usage (Starting the server)

Run the Flask application:

Or use the provided run script:

The server will start on http://localhost:5000

The app gets served using gunicorn, so you want to use a reverse-proxy like nginx and maybe a process manager.

Using the web interface

  1. Upload an image: Drag and drop an image or click "Select Image"
  2. Choose cloaking mode:
    • Low: Fastest, minimal protection (CPU/GPU)
    • Mid: Balanced protection and speed (GPU required)
    • High: Maximum protection, slower (GPU required)
  3. Start cloaking: Click "Start Cloaking" and monitor progress in the console
  4. Download: Once complete, download your cloaked image

Supported image formats

  • PNG
  • JPEG/JPG
  • GIF
  • BMP

Maximum file size: 16MB

How Fawkes Works

Fawkes adds pixel-level perturbations to images that are invisible to the human eye but cause facial recognition models to misidentify faces. These "cloaks" are specifically designed to:

  • Remain imperceptible to humans
  • Persist through image compression and social media uploads
  • Protect against feature extraction by facial recognition systems

For more technical details, see the original Fawkes repository.

Cloaking Modes

Low Mode

  • Fastest processing
  • Basic protection
  • Works on CPU
  • Recommended for quick tests

Mid Mode

  • Balanced protection
  • Moderate processing time
  • Requires GPU
  • Good for general use

High Mode

  • Maximum protection
  • Longest processing time
  • Requires GPU
  • Recommended for high-security needs

GPU Support

The application automatically detects GPU availability:

  • With GPU: All three modes (Low, Mid, High) are available
  • Without GPU: Only Low mode is available

To enable GPU support, ensure you have:

  • CUDA-compatible GPU
  • Appropriate CUDA drivers
  • TensorFlow with GPU support: pip install tensorflow-gpu

Output Files

Adhering to Fawke's principles of privacy, the app will purge every image from the server as soon as the cloaking is finished.

Performance Tips

  1. Use GPU: Processing is significantly faster with GPU support
  2. Image size: Smaller images process faster; consider resizing large images
  3. Mode selection: Use Low mode for testing, High mode for final images

Credits

License

This web interface is provided as-is. Please refer to the original Fawkes repository for licensing information regarding the Fawkes algorithm and implementation.

Disclaimer

This tool is intended for privacy protection and educational purposes. Users are responsible for ensuring their use complies with applicable laws and regulations. The effectiveness of Fawkes may vary depending on the facial recognition system being protected against.