Home

Awesome

SyncDiffusion: Coherent Montage via Synchronized Joint Diffusions, NeurIPS 2023

demo

arXiv | Project Page | Hugging Face <br>

Yuseung Lee, Kunho Kim, Hyunjin Kim, Minhyuk Sung <br>

Updates

Introduction

This repository contains the official implementation of SyncDiffusion: Coherent Montage via Synchronized Joint Diffusions.<br> SyncDiffusion is a plug-and-play module that synchronizes multiple diffusions through gradient descent from a perceptual similarity loss. More results can be viewed on our project page.

The remarkable capabilities of pretrained image diffusion models have been utilized not only for generating fixed-size images but also for creating panoramas. However, naive stitching of multiple images often results in visible seams. Recent techniques have attempted to address this issue by performing joint diffusions in multiple windows and averaging latent features in overlapping regions. However, these approaches, which focus on seamless montage generation, often yield incoherent outputs by blending different scenes within a single image. To overcome this limitation, we propose SyncDiffusion, a plug-and-play module that synchronizes multiple diffusions through gradient descent from a perceptual similarity loss. Specifically, we compute the gradient of the perceptual loss using the predicted denoised images at each denoising step, providing meaningful guidance for achieving coherent montages. Our experimental results demonstrate that our method produces significantly more coherent outputs compared to previous methods (66.35% vs. 33.65% in our user study) while still maintaining fidelity (as assessed by GIQA) and compatibility with the input prompt (as measured by CLIP score).

Get Started

Our code is tested with Python 3.9, CUDA 11.3 and Pytorch 1.12.1.

Installation

First, clone our repository:

git clone https://github.com/KAIST-Geometric-AI-Group/SyncDiffusion.git
cd SyncDiffusion

Then you either can create a new conda environment:

conda env create -f environment.yaml
conda activate syncdiffusion

or install essential packages into an existing environment:

pip install -r requirements.txt

Generation

We provide a simple demo code for SyncDiffusion at notebooks/syncdiffusion_demo.ipynb.

You can also generate a panorama with SyncDiffusion by:

sh sample_syncdiffusion.sh

Gradio Demo

We provide a Hugging Face Demo where you can directly run SyncDiffusion with custom prompts. You can also run a Gradio Demo for SyncDiffusion locally with the below code, with an easy control of the hyperparameters. First, install Gradio with

pip install gradio

and run the demo with

python gradio_syncdiffusion.py
<p style="text-align:center"> <img src="./docs/figures/gradio_demo.png" width="1000"> </p>

Setting SyncDiffusion Hyperparameters

<p style="text-align:center"> <img src="./docs/figures/syncdiffusion_diff_weights.png" width="800"> </p>

Citation

If you find our work useful, please consider citing:

@article{lee2023syncdiffusion,
    title={SyncDiffusion: Coherent Montage via Synchronized Joint Diffusions}, 
    author={Yuseung Lee and Kunho Kim and Hyunjin Kim and Minhyuk Sung},
    journal={arXiv preprint arXiv:2306.05178},
    year={2023}
}

Acknowledgement

Our code is heavily based on the official implementation of MultiDiffusion. We borrowed the Github template from SALAD.