peterzhousz / ddrm Goto Github PK
View Code? Open in Web Editor NEWThis project forked from bahjat-kawar/ddrm
This project forked from bahjat-kawar/ddrm
# Denoising Diffusion Restoration Models (DDRM) [Bahjat Kawar](https://il.linkedin.com/in/bahjat-k), [Michael Elad](https://elad.cs.technion.ac.il/), [Stefano Ermon](http://cs.stanford.edu/~ermon), [Jiaming Song](http://tsong.me) DDRM use pre-trained [DDPMs](https://hojonathanho.github.io/diffusion/) for solving general linear inverse problems. It does so efficiently and without problem-specific supervised training. Code is coming soon... ## Running the Experiments The code has been tested on PyTorch 1.8. ### Pretrained models We use pretrained models from [https://github.com/openai/guided-diffusion](https://github.com/openai/guided-diffusion), [https://github.com/pesser/pytorch_diffusion](https://github.com/pesser/pytorch_diffusion) and [https://github.com/ermongroup/SDEdit](https://github.com/ermongroup/SDEdit) We use 1,000 images from the ImageNet validation set for comparison with other methods. The list of images is taken from [https://github.com/XingangPan/deep-generative-prior/](https://github.com/XingangPan/deep-generative-prior/) The models and datasets are placed in the `exp/` folder as follows: ```bash <exp> # a folder named by the argument `--exp` given to main.py ├── datasets # all dataset files │ ├── celeba # all CelebA files │ ├── imagenet # all ImageNet files │ ├── ood # out of distribution ImageNet images │ ├── ood_bedroom # out of distribution bedroom images │ ├── ood_cat # out of distribution cat images │ └── ood_celeba # out of distribution CelebA images ├── logs # contains checkpoints and samples produced during training │ ├── celeba │ │ └── celeba_hq.ckpt # the checkpoint file for CelebA-HQ │ ├── diffusion_models_converted │ │ └── ema_diffusion_lsun_<category>_model │ │ └── model-x.ckpt # the checkpoint file saved at the x-th training iteration │ ├── imagenet # ImageNet checkpoint files │ │ ├── 256x256_classifier.pt │ │ ├── 256x256_diffusion.pt │ │ ├── 256x256_diffusion_uncond.pt │ │ ├── 512x512_classifier.pt │ │ └── 512x512_diffusion.pt ├── image_samples # contains generated samples └── imagenet_val_1k.txt # list of the 1k images used in ImageNet-1K. ``` ### Sampling from the model ``` python main.py --ni --config {CONFIG}.yml --doc {DATASET} --timesteps {STEPS} --eta {ETA} --etaB {ETA_B} --deg {DEGRADATION} --sigma_0 {SIGMA_0} ``` where the following are options - `ETA` is the eta hyperparameter in the paper. (default: `0.85`) - `ETA_B` is the eta_b hyperparameter in the paper. (default: `1`) - `STEPS` controls how many timesteps used in the process. - `DEGREDATION` is the type of degredation allowed. (One of: `cs2`, `cs4`, `inp`, `inp_lolcat`, `inp_lorem`, `deno`, `deblur_uni`, `deblur_gauss`, `sr2`, `sr4`, `sr8`, `sr16`, `color`) - `SIGMA_0` is the noise observed in y. - `CONFIG` is the name of the config file (see `configs/` for a list) - `DATASET` is the name of the dataset used, to determine where the checkpoint file is found. For example, for sampling noisy 4x super resolution from the ImageNet 256x256 unconditional model using 20 steps: ``` python main.py --ni --config imagenet_256.yml --doc imagenet --timesteps 20 --eta 0.85 --etaB 1 --deg sr4 --sigma_0 0.05 ``` ## References and Acknowledgements ``` @article{kawar2022denoising, title={Denoising Diffusion Restoration Models}, author={Kawar, Bahjat and Elad, Michael and Ermon, Stefano and Song, Jiaming}, journal={arXiv}, year={2022}, month={January}, abbr={Preprint}, url={https://arxiv.org/abs/?} } ``` This implementation is based on / inspired by: - [https://github.com/hojonathanho/diffusion](https://github.com/hojonathanho/diffusion) (the DDPM TensorFlow repo), - [https://github.com/pesser/pytorch_diffusion](https://github.com/pesser/pytorch_diffusion) (PyTorch helper that loads the DDPM model), and - [https://github.com/ermongroup/ddim](https://github.com/ermongroup/ddim) (code structure)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.