

## Unveiling Impact of Frequency Components on Membership Inference Attacks for Diffusion Models



### Experimental environment

- The attack environment can be based on **requirements.txt**
- We provide the training code of the DDIM model in the folder train, and the attack environment can be based on **train/requirements.txt**

```
python main.py --train --logdir ./experiments/CIFAR100 --dataset CIFAR100 --img_size 32 --batch_size 128 --total_steps 800001
```

- For Stable Diffusion's finetune environment, see the **diffusers** official documentation



### Dataset and Model

Due to file size limitations, datasets and model weights can't be uploaded. You can refer to previous methods, such as SecMI, PIA, etc. You can directly download the weights of the pre-trained model and the segmented dataset.



### DDIM Attack

```bash
cd DDIM
python attack.py 
# --checkpoint your_checkpoint --dataset your_dataset --attacker_name attacker_name --Filter 1 # 0 means not using our method 
```

parameters:

- `--checkpoint`: path to the directory of checkpoints 

- `--dataset`: dataset_name (such as CIFAR100, TINY-IN, STL10-U)

- `--attacker_name`: attack_name (such as naive, pia, sec)

- `--Filter`: 1 means using our method, 0 means not using our method 

  

### SD Attack

```bash
cd Stable_Diffusion
python attack.py  
# --attack attacker_name --filter 1 # 0 means not using our method
# flags.diff_path: model_path

```

parameters:

- `--filter`: 1 means using our method, 0 means not using our method 

- `--attack`: attack_name(such as naive, pia, sec)

- `--flags.dataset`: dataset_name  (such as coco, pokemon, flickr)

- `--Filter`: 1 means using our method, 0 means not using our method 

- `flags.diff_path`: model path of stable diffusion

  

