This repository contains the official implementation of D-Plus-Minus (DPM), a principled post-hoc framework for detecting copyright infringement in text-to-image diffusion models, grounded in differential privacy.
We recommend using Anaconda to set up a clean environment:
cd DPM-copyright-infringement-detection
# Create conda environment
conda create -n dpm python=3.12 -y
conda activate dpm
# Install dependencies
pip install -r requirements.txtEdit the config YAML in ./configs/ folder before running:
| Config Field | Description |
|---|---|
images_class |
Must be one of: human_face, architecture, arts_painting |
images_name |
Name of the subfolder (concept) under ./data/CIDD-example/class/<class>/ |
output_folder |
Directory where the model checkpoints, generated images, detection results, and logs will be saved. |
⚠️ Do not modify other config values, especially those related to normalization and scoring, unless you know what you're doing.Changing them may lead to incorrect normalization in conditional sensitivity scoring and compromise the validity of the DPM confidence scores.
Choose one of the pre-defined models and run:
export CONFIG_NAME="sd_1_4"
python main.py --config-name $CONFIG_NAMESupported Model Configs:
CONFIG_NAME |
Model Description |
|---|---|
sd_1_4 |
Stable Diffusion v1.4 (full fine-tuning) |
lora_sdxl |
Stable Diffusion XL (1.0) + LoRA |
lora_sana |
SANA (0.6B) + LoRA |
lora_flux |
FLUX.1 + LoRA |
All model-specific settings are defined in the corresponding YAML files in ./configs.