The goal of this project is to further my understanding of image representation and manipulation, and produce large sections of image that is the product of multiple individual images stitched together.
Part 0: Setup
We first set up the diffusion model. The random seed used for this project is 61.
Part 1: Sampling Loops
1.1: Implementing the Forward Process
To start off, we introduce noise into our test image with the forward process.
1.2: Classical Denoising
To start denoising, we can first try the classical gaussian blur filtering.
1.3: One-Step Denoising
Now, we can actually use the diffusion model to denoise the images. We can start off by using one step denoising.
1.4: Iterative Denoising
Diffusion models are designed to denoise iteratively. In this part we will implement this.
1.5: Diffusion Model Sampling
In part 1.4, we use the diffusion model to denoise an image. Another thing we can do with the iterative_denoise function is to generate images from scratch.
1.6: Classifier-Free Guidance (CFG)
In order to greatly improve image quality (at the expense of image diversity), we can use a technicque called Classifier-Free Guidance.
1.7: Image-to-image Translation
In part 1.4, we take a real image, add noise to it, and then denoise. This effectively allows us to make edits to existing images.
Here, we're going to take the original test image, noise it a little, and force it back onto the image manifold without any conditioning. Effectively, we're going to get an image that is similar to the test image (with a low-enough noise level).
1.7.1: Editing Hand-Drawn and Web Images
This procedure works particularly well if we start with a nonrealistic image (e.g. painting, a sketch, some scribbles) and project it onto the natural image manifold.
1.7.2: Inpainting
We can use the same procedure to implement inpainting.
Now, we will do the same thing as SDEdit, but guide the projection with a text prompt.
1.8: Visual Anagrams
In this part, we will create an image that looks like "an oil painting of people around a campfire", but when flipped upside down will reveal "an oil painting of an old man".
1.9: Hybrid Images
In this part we'll implement Factorized Diffusion and create hybrid images just like in project 2.