We provide the implementation code for our proposed methods. To evaluate them, you first need to generate images using the generation code. Once the images are generated, you can run the evaluation code on them. Detailed instructions for both image generation and evaluation are provided below.



1. Image generation

# No Mitigation
python3 generate_images.py --seed 2

# Run Per-sample mitigation (ours)
python3 generate_images.py --seed 2 --method adj_init_noise --per_sample --target_loss 0.9 --lr 0.01

# Run Batch-wise mitigation (ours)
python3 generate_images.py --seed 2 --method adj_init_noise --batch_wise --rho 50 --gamma 0.7 --adj_iters 2 --apply_cfg_step 4



2. Evaluation

# Calculate SSCD and CLIP scores
python3 metrics/compute_sscd_orig_clip_score.py --gen_folder GEN_IMG_DIR --prompts prompts/memorized_laion_prompts.csv

# Calculate FID
python3 metrics/compute_fid.py --gen_folder GEN_IMG_DIR --reference_folder sdv1_500_mem_groundtruth/10000_laion_images/

