
# StableFace

<a href="https://www.buymeacoffee.com/outofai" target="_blank"><img src="https://img.shields.io/badge/-buy_me_a%C2%A0coffee-red?logo=buy-me-a-coffee" alt="Buy Me A Coffee"></a>
[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=Ashleigh%20Watson)](https://twitter.com/OutofAi) 
[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=Alex%20Nasa)](https://twitter.com/banterless_ai)
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/OutofAi/StableFace/blob/main/CH7_stable_face.ipynb)

## Build your own Face App with Stable Diffusion 2.1 Base
https://github.com/OutofAi/StableFace/assets/145302363/6e9e414a-f3da-47ca-9ad6-61b4bbf9e198


A set of simple notebooks to create a clear understanding on Stable Diffusion aspects like sampling, architecture, CFG, attention layers, inverse scheduler, pivotal inversion, image reconsutrction and prompt2prompt editting which we utilise to achieve hyperreaslitic results to edit any real-world face and build a pipeline to build your own face app.

(You can skip to Chapter 7 if you are already familiar with the basics of SD)

|||
|:--------|:---------------:|
| *Chapter 1: Sampling but not Inference*<br> A Simple example of how to create/sample an image with diffusers pipeline<br><br> | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/OutofAi/StableFace/blob/main/CH1_sampling.ipynb) |
| *Chapter 2: Stable Diffusion Dissected*<br> Exploring the individual elements that results in image generation<br><br> | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/OutofAi/StableFace/blob/main/CH2_breakdown.ipynb) |
| *Chapter 3: Spicing it up with CFG*<br> Exploring Classifier-Free Guidance to enhance image generation.<br><br> | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/OutofAi/StableFace/blob/main/CH3_CFG.ipynb) |
| *Chapter 4: Attention, Please!*<br> Overriding attention layer tomanipulate image generation process<br><br> | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/OutofAi/StableFace/blob/main/CH4_attention_breakdown.ipynb) |
| *Chapter 5: Attention Switcheroo*<br> Shared cross-attention layers between multiple images.<br><br> | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/OutofAi/StableFace/blob/main/CH5_attention_replace.ipynb) |
| *Chapter 6: Reality Check*<br> DDIM-inversion and pivotal tuning for accurate image reconstruction.<br><br> | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/OutofAi/StableFace/blob/main/CH6_reconstruction.ipynb) |
| *Chapter 7: FaceApp, Who?*<br> Synthesise learnings to create an advanced facial feature editing system.<br><br> | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/OutofAi/StableFace/blob/main/CH7_stable_face.ipynb) |

|||
|:--------|:---------------:|
| *Appendix 1: FaceApp, XL!!*<br> SD XL based face editing with corrective actions.<br><br> | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/OutofAi/StableFace/blob/main/APDX1_stable_face_XL.ipynb) |
