Fixing Faces in Stable Diffusion using ADetailer Extension

Updated
Fixing Faces in Stable Diffusion using ADetailer Extension
Restore and Fix Faces with ADetailer Extension in Stable Diffusion. Your Guide to Achieving Flawless Face Enhancements and Perfection.

1. Introduction

Welcome to the ultimate guide for restoring and fixing faces with ADetailer Extension in stable diffusion. Explore the art of seamless facial enhancements as we unveil the power of this innovative tool. Whether you're a photography enthusiast, digital artist, or someone eager to master facial restoration, this guide navigates you through achieving pixel-perfect results. Join us in mastering the intersection of innovation and imagery, and elevate your skills in facial restoration.

2. Installing ADetailer Extension (A1111)

To assist with restoring faces and fixing facial concerns using Stable Diffusion, you'll need to acquire and install an extension called "ADetailer," which stands for "After Detailer." Here are the steps to follow:

  • Navigate to the "Extensions" tab within Stable Diffusion.
  • Go to the "Install from URL" subsection.
  • Paste the following URL: https://github.com/Bing-su/adetailer
  • Click on the "Install" button to install the extension

fixing-faces-in-stable-diffusion-using-adetailer-extension-install.webp

After the installation is complete, navigate to the "Installed" section. From there, click on "Apply and restart UI" to restart the User Interface. This step guarantees the extension's successful installation. Once the installation is successful, you'll be able to locate the downloaded extension in the "\stable-diffusion-webui\extensions" folder. In this case you should see a folder called "adetailer".

Once the user interface has been successfully restarted, you will notice an expansion panel as you scroll down in both the "txt2img" and "img2img" tabs. When the ADetailer expansion panel is opened up, it will appear similar to this:

fixing-faces-in-stable-diffusion-using-adetailer-extension-install-preview-extension.webp

Stable Diffusion in the Cloud⚡️Run Automatic1111 in your browser in under 90 seconds
20% bonus on first deposit

3. When to use the ADetailer Extension?

Typically, when crafting full-body portraits or images where the subject is at a distance, you might observe faces becoming blurred or distorted. When facing this challenge, it's a strong indicator that the ADetailer extension could be your solution. This extension has the potential to restore faces when applied correctly. Below is an image created with "txt2img" where the face doesn't look natural and seems distorted.

fixing-faces-in-stable-diffusion-using-adetailer-extension-install-preview-extension-example1_nextdiffusion.webp

  • Positive Prompt: (full body portrait), (full body), woman, woman wearing red summer dress, red dress, latina woman, curly hair, cleavage, perfect light, perfect shadows, beach background, palm trees
  • Negative Prompt: (worst quality:1.2), (low quality:1.2), (lowres:1.1), (monochrome:1.1), (greyscale), multiple views, comic, sketch, (((bad anatomy))), (((deformed))), (((disfigured))), watermark, multiple_views, mutation hands, mutation fingers, extra fingers, missing fingers, watermark
  • Sampling Steps: 30
  • Sampler: DDIM
  • CFG scale: 7
  • Size: 512x800
  • Seed: 460251040
  • Model: Realistic Vision

When you see outcomes like those shown above, it's a suitable moment to activate the "ADetailer" extension. Next, we'll explore how to utilize the extension to correct the face.

4. How to use the ADetailer Extension (Settings Explained)

To begin the process of restoring the face, we must first enable the After Detailer Extension. This can be accomplished by checking the "Enable ADetailer" checkbox located at the top of the expansion panel.

ADetailer model

Next it is time to choose the appropriate detection model from the "ADetailer model" dropdown menu. The models are categorized into several groups:

  • Face: Detect and enhance faces (Works pretty well)
  • Hand: Detect and enhance hands (Does not work really well)
  • Person: Detect and enhance entire individuals (Works pretty well)
  • Mediapipe_face: Detect and enhance faces (Not recommended)

Prompts

In the prompt sections you have the option to fill in the positive and the negative prompt. Here, you should focus on the specific area you want to fix. For instance, in our example, we aim to repair a distorted face. Our prompt could look something like this: "detailed face, clear face, Latina woman's face.". You also have the option to use LoRA's inside the ADetailer prompt section, but for this example we choose not to use one.

Leaving a prompt empty results in the use of the main prompt. In our scenario, we didn't fill in the negative prompt within the ADetailer Extension, so it will rely on our main prompt.

My Settings Used

Below you can find the settings to restore the face of the woman:

fixing-faces-in-stable-diffusion-using-adetailer-extension-install-preview-extension-settings-used.webp

Once you've activated the extension and selected the appropriate model, it's time to click the "Generate" button and observe whether it can successfully restore the face.

Stable Diffusion in the Cloud⚡️Run Automatic1111 in your browser in under 90 seconds

5. Restored Face Example (ADetailer Extension Enabled)

Once the generation process is complete, you can judge for yourself whether the face has improved or not. Here's an example of a restored face below:

fixing-faces-in-stable-diffusion-using-adetailer-extension-fixed-face.webp

In the enhanced image shown above, you'll notice a significant improvement in the quality of the face compared to its previous state. To offer a quick comparison:

fixing-faces-in-stable-diffusion-using-adetailer-extension-fixed-face-comparison.webp

For this comparison we used the same seed of the image

6. TIP: Upscaling Your Image for even Better Quality

Certainly, you can enhance your image further by upscaling it to include even more intricate details across the entire picture. Are you interested in discovering how to upscale an image using the capabilities of Stable Diffusion?

High-Quality Upscaling Made Easy in Stable Diffusion

Stable Diffusion in the Cloud⚡️Run Automatic1111 in your browser in under 90 seconds

7. Conclusion

The ADetailer Extension within stable diffusion emerges as a transformative solution for restoring and fixing facial flaws. By automating processes and seamlessly enhancing features, this extension empowers users to achieve impeccable outcomes. From blurred faces to distorted features, ADetailer delivers efficient and effective restoration. This guide has showcased the extension's capabilities, from prompt customization to the use of YOLO models for accurate detection. Embrace automation and elevate your images to new heights with the ADetailer Extension in stable diffusion.

Frequently Asked Questions

Everything achievable in ADetailer can also be done manually. What ADetailer accomplishes is the automation of the subsequent steps:

  • Sending the image for inpainting.
  • Constructing an inpaint mask.
  • Configuring ControlNet (Optional).
  • Generating inpaint.

The primary advantage of utilizing this extension lies in automation, enabling the creation of multiple images with uniform settings (batch size larger than 1). Achieving this manually can be arduous and time-consuming. If streamlining tasks through automation, including facial restoration, appeals to you, using the ADetailer extension is recommended. It can help you save time and effort that would otherwise be spent on manual work.

Yes, the ADetailer Extension can indeed be used in conjunction with ControlNet. This becomes particularly advantageous when your character assumes a specific pose. In such cases, the face will be accurately positioned based on that pose, resulting in a more natural appearance.