Skip to content

[CVPR 2024] Tackling the Singularities at the Endpoints of Time Intervals in Diffusion Models

Notifications You must be signed in to change notification settings

PangzeCheung/SingDiffusion

Repository files navigation

SingDiffusion

The source code for our paper "Tackling the Singularities at the Endpoints of Time Intervals in Diffusion Models", Pengze Zhang*, Hubery Yin*, Chen Li, Xiaohua Xie, CVPR 2024 (Highlight).

Project Page | Arxiv

framework

Abstract

Most diffusion models assume that the reverse process adheres to a Gaussian distribution. However, this approximation has not been rigorously validated, especially at singularities, where t=0 and t=1. Improperly dealing with such singularities leads to an average brightness issue in applications, and limits the generation of images with extreme brightness or darkness. We primarily focus on tackling singularities from both theoretical and practical perspectives. Initially, we establish the error bounds for the reverse process approximation, and showcase its Gaussian characteristics at singularity time steps. Based on this theoretical insight, we confirm the singularity at t=1 is conditionally removable while it at t=0 is an inherent property. Upon these significant conclusions, we propose a novel plug-and-play method SingDiffusion to address the initial singular time step sampling, which not only effectively resolves the average brightness issue for a wide range of diffusion models without extra training efforts, but also enhances their generation capability in achieving notable lower FID scores.

framework

1) Get start

  • Python 3.9.0
  • CUDA 11.2
  • NVIDIA A100 40GB PCIe
  • Torch 2.0.1
  • Torchvision 0.15.2

Please follow diffusers to install diffusers.

2) Install pre-trained SingDiffusion module into ./SingDiffusion

3) Generate image for testing average brightness issue

Sampling with SingDiffusion

python python test_sing_diffusion_img2img_average_brightness.py --out_dir XXX 

Sampling without SingDiffusion

python python test_sing_diffusion_img2img_average_brightness.py --out_dir XXX --no_SingDiffusion

4) Generate image for testing COCO dataset

Download 30K COCO prompt into ./COCO_3W_prompt.json

Sampling with SingDiffusion

python python test_sing_diffusion_img2img_COCO.py --out_dir XXX 

Sampling without SingDiffusion

python python test_sing_diffusion_img2img_COCO.py --out_dir XXX --no_SingDiffusion

Citation

@inproceedings{
zhang2024tackling,
title={Tackling the Singularities at the Endpoints of Time Intervals in Diffusion Models},
author={Pengze Zhang and Hubery Yin and Chen Li and Xiaohua Xie},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
year={2024}
}

Acknowledgement

We build our project based on diffusers. We thank them for their wonderful work and code release.

About

[CVPR 2024] Tackling the Singularities at the Endpoints of Time Intervals in Diffusion Models

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages