This is the official repository for the Diffusion Image Analogies paper published at the SIGGRAPH 2023 Conference Proceedings.
- Clone the repo
git clone --recurse-submodules https://github.com/subrtadel/DIA.git cd ./DIA - Create environment
conda create -n dia_env conda activate dia_env conda install python=3.8.5 pip=20.3 cudatoolkit=11.3 pytorch=1.11.0 torchvision=0.12.0 numpy=1.19.2 -c pytorch -c nvidia -c conda-forge -c defaults - Install packages
pip install -r requirements.txt cd ./stable-diffusion/ pip install -e git+https://github.com/CompVis/taming-transformers.git@master#egg=taming-transformers pip install -e .
- Download the sd-v1-4.ckpt model and put it into correct folder
mkdir -p ./models/ldm/stable-diffusion-v1/ - Install Image Magick.
- Upload images into
./dataset/raw_data/folder.
- Run
process_new_data.py. The images are assignedfile_ids in a%05dformat.
- Define the triplets in a
.csvfile. Refer to the images by theirfile_id. Example file istriplets.csv. First column specifies theAinput, second theA'and the thirdBinput. Either with of without filename suffixes is fine.
- Run the
precompute_noises_and_conditionings.pyscript. This may take a while.python precompute_noises_and_conditionings.py \ --config ./config/parameter_estimation.yaml \ --inversion_subfolder noise \ --token_subfolder tokens \ --triplet_file triplets.csv \ --data_path ./dataset/data/
- Check the
./config/analogy_params.yaml.
- Run the
do_analogies.pyscript.python do_analogies.py \ --config ./config/parameter_estimation.yaml \ --inversion_subfolder noise \ --token_subfolder tokens \ --output_subfolder analogies \ --triplet_file triplets.csv \ --data_path ./dataset/data/
@inproceedings{Subrtova2023DIA,
title = {Diffusion Image Analogies},
author = {A. \v{S}ubrtov\'{a} and M. Luk\'{a}\v{c} and J. \v{C}ech and D. Futschik and E. Shechtman and D. S\'{y}kora},
booktitle = {ACM SIGGRAPH 2023 Conference Proceedings},
year = {2023}
}