Skip to content

Official PyTorch implementation of the NeurIPS 2022 paper "Improving Diffusion Models for Inverse Problems using Manifold Constraints (https://arxiv.org/abs/2206.00941)"

License

Notifications You must be signed in to change notification settings

HJ-harry/MCG_diffusion

Repository files navigation

Improving Diffusion Models for Inverse Problems using Manifold Constraints (NeurIPS 2022)

Official PyTorch implementation of the NeurIPS 2022 paper "Improving Diffusion Models for Inverse Problems using Manifold Constraints". Code modified from guided-diffusion and score_sde_pytorch.

arXiv arXiv concept concept concept

For each task, we additionally provide some re-implementations of diffusion model-based inverse problem solvers.

Improving Diffusion Models for Inverse Problems using Manifold Constraints
Hyungjin Chung, Hyungjin Chung, Jong Chul Ye
NeurIPS 2022

Abstract:
Recently, diffusion models have been used to solve various inverse problems in an unsupervised manner with appropriate modifications to the sampling process. However, the current solvers, which recursively apply a reverse diffusion step followed by a projection-based measurement consistency step, often produce sub-optimal results. By studying the generative sampling path, here we show that current solvers throw the sample path off the data manifold, and hence the error accumulates. To address this, we propose an additional correction term inspired by the manifold constraint, which can be used synergistically with the previous solvers to make the iterations close to the manifold. The proposed manifold constraint is straightforward to implement within a few lines of code, yet boosts the performance by a surprisingly large margin. With extensive experiments, we show that our method is superior to the previous methods both theoretically and empirically, producing promising results in many applications such as image inpainting, colorization, and sparse-view computed tomography.

Getting Started

Setting the environment

Our code was tested on the following environment

  • Ubuntu 20.04
  • CUDA 10.2
  • PyTorch 1.6.0

We provide the install script in install.sh. Be sure to have conda ready, as we will be using conda to build the environment. Once ready, simply run the following command:

source install.sh

The above command will create a conda environment, and install the dependencies listed in requirements.txt.

Pretrained checkpoints

The install script will automatically download the pre-trained checkpoints and place it in the checkpoints directory. Alternatively, you may download the pre-trained checkpoints used for each task from the links below.

FFHQ 256x256 ImageNet 256x256 LSUN-bedroom AAPM Original repository
Inpainting Link Link Link - Guided diffusion
Colorization Link - Link - Score-SDE
SV-CT - - - Link -

Solving Inverse Problems with MCG

For all tasks, we provide some sample data, which is contained in the samples folder, which will be automatically downloaded with the install script. You may alternatively get the data here. All results will be saved in the results folder.

Inpainting

Run the following command to perform inpainting with the default configurations.

bash run_inpainting.sh

You may try other sampling strategies other than MCG by changing the flag --sample_method to vanilla (score-SDE), or repaint (RePAINT).

Colorization

Run the following command. Change the parameters directly in the python script as needed.

python run_colorization.py

Sparse-view CT reconstruction (SV-CT)

Run the following command. Change the parameters directly in the python script as needed.

python run_CT_recon.py

We additionally provide our re-implementation of this paper. Set solver='song' when you wish to run the solver introduced in Song et al..

Citation

If you find our work interesting, please consider citing

@InProceedings{chung2022improving,
  title={Improving Diffusion Models for Inverse Problems using Manifold Constraints},
  author={Chung, Hyungjin and Sim, Byeongsu and Ye, Jong Chul},
  journal={Advances in Neural Information Processing Systems},
  year={2022}
}

About

Official PyTorch implementation of the NeurIPS 2022 paper "Improving Diffusion Models for Inverse Problems using Manifold Constraints (https://arxiv.org/abs/2206.00941)"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages