Skip to content

novel framework for Stable Diffusion-based Momentum Integrated Adversarial Examples (SD-MIAE)

Notifications You must be signed in to change notification settings

nashrahhaque/SD-MIAE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SDMIAE: Stable Diffusion-based Momentum Integrated Adversarial Examples

This repository contains the implementation of the SDMIAE attack as seen in the paper: https://arxiv.org/abs/2410.13122, which applies momentum-based iterative adversarial perturbations to images generated using the Stable Diffusion model. The aim is to generate adversarial examples that can mislead a pre-trained classifier while maintaining imperceptibility using Stable Diffusion for image generation.

Setup Instructions

To set up the environment for using SDMIAE, follow these steps:

  1. Create a new Conda environment:

    conda create -n sdmiae python=3.9
  2. Activate the environment:

    conda activate sdmiae
  3. Install the necessary dependencies:

    python -m pip install torch torchvision torchaudio  
    python -m pip install xformers diffusers transformers accelerate pandas
  4. Clone the repository:

    git clone https://github.com/nashrahaque/sdmiae.git
    cd sdmiae

Running the Code

Once the environment is set up, you can run the code using the following command:

python sdmiae.py --img_size 128 --guidance_scale 9.5 --epsilon 0.2 --mu 1.0 --num_inference_steps 20 --num_samples_per_class 10 --class_ids 0 10

Results and Acknowledgments

The generated adversarial examples will be saved in the results/ directory, organized by class label. Each adversarial image is saved as sample_{j:02d}.png within its respective class folder.

This framework is built upon the work of SD-NAE.

About

novel framework for Stable Diffusion-based Momentum Integrated Adversarial Examples (SD-MIAE)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages