Code Monkey home page Code Monkey logo

conffusion's Introduction

Conffusion: Confidence Intervals for Diffusion Models

Official PyTorch Implementation for the "Conffusion: Confidence Intervals for Diffusion Models" paper.

Conffusion: Given a corrupted input image, our method Conffusion, repurposes a pretrained diffusion model to generate lower and upper bounds around each reconstructed pixel. The true pixel value is guaranteed to fall within these bounds with probability p. We present the bounds for inpainting (the context is dimmed for visualization) and super-resolution. Tighter intervals provide more information; we visualize the normalized interval size, darker values are tighter intervals


Conffusion: Confidence Intervals for Diffusion Models
Eliahu Horwitz, Yedid Hoshen
http://arxiv.org/abs/2211.09795

Abstract: Diffusion models have become the go-to method for many generative tasks, particularly for image-to-image generation tasks such as super-resolution and inpainting. Current diffusion-based methods do not provide statistical guarantees regarding the generated results, often preventing their use in high-stakes situations. To bridge this gap, we construct a confidence interval around each generated pixel such that the true value of the pixel is guaranteed to fall within the interval with a probability set by the user. Since diffusion models parametrize the data distribution, a straightforward way of constructing such intervals is by drawing multiple samples and calculating their bounds. However, this method has several drawbacks: i) slow sampling speeds ii) suboptimal bounds iii) requires training a diffusion model per task. To mitigate these shortcomings we propose Conffusion, wherein we fine-tune a pre-trained diffusion model to predict interval bounds in a single forward pass. We show that Conffusion outperforms the baseline method while being three orders of magnitude faster.

Getting Started

Setup

  1. Clone the repo:
git clone https://github.com/eliahuhorwitz/Conffusion.git
cd Conffusion
  1. Create a new environment and install the libraries:
python3 -m venv conffusion_venv
source conffusion_venv/bin/activate
pip install -r requirements.txt
  1. Download the data from the here and extract it into a dir named datasets

  2. Run the desired model by following the links below:

N-Conffusion

Super-resolution: N-Conffusion code for super-resolution (also includes DMSB and DMSBA code)

Inpainting: N-Conffusion code for inpainting (also includes DMSB and DMSBA code)

G-Conffusion

Super-resolution + Inpainting: G-Conffusion code for super-resolution and inpainting

Citation

If you find this useful for your research, please use the following.

@article{horwitz2022conffusion,
  title={Conffusion: Confidence Intervals for Diffusion Models},
  author={Horwitz, Eliahu and Hoshen, Yedid},
  journal={arXiv preprint arXiv:2211.09795},
  year={2022}
}

Acknowledgments

  • The SR3 implementation is based on this unofficial implementation of SR3.
  • The Palette implementation is based on this unofficial implementation of Palette.
  • The Guided-diffusion implementation is based on this official implementation.
  • The implementation of the calibration and evaluation metrics is based on this official implementation of im2im-uq.

conffusion's People

Contributors

eliahuhorwitz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

conffusion's Issues

Reproducing results from paper - inpainting

Hi,

We are having trouble reproducing results from paper for the inpainting section (N-Conffusion).
We have run the scripts as written, but we end up with these results:
image
Please let us know if we have to change any training parameters to reproduce the bounds from the paper.

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.