**Cats Photo Editing**
# Overview This assignment focuses on image editing techniques that involve manipulating images within the realm of natural images. The first part involves inverting a pre-trained generator to find a latent variable that closely reconstructs a given real image. In the second part, you will take a hand-drawn sketch and generate an image that matches the sketch. The final part involves generating images based on an input sketch image and a prompt using stable diffusion. Throughout these tasks, you will experiment extensively with various models, loss functions, and hyperparameters to identify the best combination for each task and observe their effects on the generated images. # Inverting the generator In this task, you will utilize a pre-trained generator and invert it to reconstruct an input image. The process involves optimizing the latent variable to minimize the loss between the generated image and the input image. You will experiment with different models, loss functions, and hyperparameters to identify the best combination for this specific task. All the experiments in this section ran for a total of 1000 iterations, which took approximately 30 seconds to complete on a single 2080 Ti GPU. ## Ablation across different losses (latent fixed to w+, from_mean = True) We use a combination of L1 and perceptual loss over the generated and L2 regularization loss on delta on the parameter with different weights to choose the best hyperparameters| Perceptual loss weight | L1 loss weight | L2 regularization weight | Generated Image |
|---|---|---|---|
| 0.01 | 10.00 | 0.0 | ![]() |
| 0.1 | 10.00 | 0.0 | ![]() |
| 0.01 | 10.00 | 0.01 | ![]() |
| 0.01 | 5.00 | 0.0 | ![]() |
| 0.1 | 10.00 | 0.01 | ![]() |
| from_mean | Generated image |
|---|---|
| True | ![]() |
| False | ![]() |
| latent | Generated image |
|---|---|
| w+ | ![]() |
| w | ![]() |
| z | ![]() |
| model | Generated image |
|---|---|
| StyleGAN | ![]() |
vanilla GAN | ![]() |
| Sketch | Mask | Generated Image |
|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
| Sketch | Mask | Generated Image |
|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
| Prompt | Generated Image |
|---|---|
| Grumpy cat reimagined as a royal painting | ![]() |
| Happy cat reimagined as a royal painting | ![]() |
| seed | Generated Image |
|---|---|
| 10 | ![]() |
| 0 | ![]() |
| 5 | ![]() |
| Guidance strength | Generated Image |
|---|---|
| 15 | ![]() |
| 5 | ![]() |
| 30 | ![]() |
| DDPM sampling steps | Generated Image |
|---|---|
| 500 | ![]() |
| 800 | ![]() |
| Prompt | Input Image | Generated Image |
|---|---|---|
| A house on a field with a road leading up to it on a sunny day | ![]() |
![]() |
| A beautiful road leading to snow covered mountains through a jungle | ![]() |
![]() |
| Orange Cat smiling | ![]() |
![]() |
| Image 1 | Interpolation gif | Image 2 |
|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |