Commit
·
a74e93a
1
Parent(s):
9c88b04
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- ddpm_diffusion
|
| 4 |
+
---
|
| 5 |
+
|
| 6 |
+
# Denoising Diffusion Probabilistic Models (DDPM)
|
| 7 |
+
|
| 8 |
+
**Paper**: [Denoising Diffusion Probabilistic Models](https://arxiv.org/abs/2006.11239)
|
| 9 |
+
|
| 10 |
+
**Abstract**:
|
| 11 |
+
|
| 12 |
+
*We present high quality image synthesis results using diffusion probabilistic models, a class of latent variable models inspired by considerations from nonequilibrium thermodynamics. Our best results are obtained by training on a weighted variational bound designed according to a novel connection between diffusion probabilistic models and denoising score matching with Langevin dynamics, and our models naturally admit a progressive lossy decompression scheme that can be interpreted as a generalization of autoregressive decoding. On the unconditional CIFAR10 dataset, we obtain an Inception score of 9.46 and a state-of-the-art FID score of 3.17. On 256x256 LSUN, we obtain sample quality similar to ProgressiveGAN.*
|
| 13 |
+
|
| 14 |
+
## Usage
|
| 15 |
+
|
| 16 |
+
```python
|
| 17 |
+
# !pip install diffusers
|
| 18 |
+
from diffusers import DiffusionPipeline
|
| 19 |
+
import PIL.Image
|
| 20 |
+
import numpy as np
|
| 21 |
+
|
| 22 |
+
model_id = "fusing/ddpm-lsun-cat-ema"
|
| 23 |
+
|
| 24 |
+
# load model and scheduler
|
| 25 |
+
ddpm = DiffusionPipeline.from_pretrained(model_id)
|
| 26 |
+
|
| 27 |
+
# run pipeline in inference (sample random noise and denoise)
|
| 28 |
+
image = ddpm()
|
| 29 |
+
|
| 30 |
+
# process image to PIL
|
| 31 |
+
image_processed = image.cpu().permute(0, 2, 3, 1)
|
| 32 |
+
image_processed = (image_processed + 1.0) * 127.5
|
| 33 |
+
image_processed = image_processed.numpy().astype(np.uint8)
|
| 34 |
+
image_pil = PIL.Image.fromarray(image_processed[0])
|
| 35 |
+
|
| 36 |
+
# save image
|
| 37 |
+
image_pil.save("test.png")
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
## Samples
|
| 41 |
+
|
| 42 |
+
1. 
|
| 43 |
+
2. 
|
| 44 |
+
3. 
|
| 45 |
+
4. 
|