How to Use ADetailer (After Detailer) in Stable Diffusion?

author - Rico Rodriguez
Rico Rodriguez

Updated on

Stable Diffusion ADetailer, or After Detailer, is an extension made to function with the Stable Diffusion web interface. It enhances image details, especially using a technique known as inpainting.

Here's a breakdown of what ADetailer does:

Improves Image Detail: ADetailer is particularly useful for addressing areas in a Stable Diffusion-generated image that may lack detail, like faces or hands.

To be more specific, ADetailer mainly aims to fix distorted or garbled faces in your Stable Diffusion AI-generated images. As for those SD-generated images needed to be upscaled 2X, 4X or even higher resolution, ADetailer is willing to but powerless to render help.

Thankfully, Aiarty Image Enhancer makes your SD AI arts work a breeze. By courtesy of its auto Deblur, denoise, deJPEG, upscale & enhance image workflow, it helps you upscale your Stable Diffusion generated images to 2X, 4X, 8X original size, up to 32K and meanwhile ensures you a Hollywood-level quality with more details generated (incl. skin texture, wrinkles, hair, fur), no distortion, garble, blur, pixelation, grain issues. Bigger, sharper and clearer!

AI txt2img output
AI txt2img output enhanced by Aiarty

Free download this top-end AI image enhancer to remove noise, unblur and enhance images with more details!

Automatic Masking: The extension can automatically detect objects within the image and create masks around them. These masks define the areas for improvement.

Inpainting: Using the masks and the original image, ADetailer performs inpainting. This essentially fills in the masked areas with more detailed and realistic content.

How to Use SD ADetailer to Fix Distorted/Garbled Face?

Before ADetailer, the common method to fix distorted or garbled face generated by SD is using inpainting feature. Manually draw a mask around the problematic face area, select the Mask mode to be Inpaint masked, set the Masked content to original and the Inpaint area to Only masked, and then hit Generate.

Experience the remarkable transformation as the tool skillfully restores the face, utilizing the full resolution (512×512) to enhance the masked area. The outcome is a significantly improved facial appearance.

But the traditional inpainting is sort of manual method. Unlikely, ADetailer features a face recognition model to automatically detect faces, generate the inpaint mask and then auto inpaint the face to solve distorted or garbled faces issue. Check the more advanced After Detailer method workflow:

Step 1. Prepare your Stable Diffusion GUI on your Windows PC, Mac or Google Colab first.

Step 2. Install Adetailer extension on your Windows or Mac. Follow these steps to install the Regional Prompter extension in AUTOMATIC1111.

  1. Start AUTOMATIC1111 Web-UI as usual.
  2. Head to Extension Page, followed by a " Install from URL" option click.
  3. Enter the following URL in the URL for extension's git repository field: https://github.com/Bing-su/adetailer
  4. Wait for the confirmation message that the installation is complete. Restart web-UI. And that's it!

Step 3. Go to the txt2img tab, insert your prompts text, negative prompts and tweak the related settings:

  • Set the checkpoint model to dreamshaper_8
  • Positive Prompts: A handsome cool man with charming eyes standing on a sidewalk, distance from the camera, looking at the camera, low angle, warm light, high quality, masterpiece, 4k
  • Negative prompts: Deformed, blurry, lowres, low quality
  • Sampling method: Euler a; sampling steps: 20
  • Resolution: 512x512; CFG scale: 7
insert text prompts into Stable Diffusion

Step 4. Scroll down to the ADetailer section, where enable it and select the "face_yolo8n.pt" model from the ADetailer model dropdown menu.

enable ADetailer in Stable Diffusion

Step 5. Click 'Generate' to instantly witness the face restoration. You don't have to manually do the inpainting stuff, just quietly waiting for the auto inpainting processor to finish its job. Here we can see that the face is much better using aDetailer without the need for manually doing any inpainting.

Generate a man with Adetailer in Stable Diffusion

Now that you've grasped the basics, let's delve into additional parameters that allow fine-tuning of ADetailer's functionality.

Get Closer to ADetailer's Parameters

ADetailer offers several parameters you can adjust to fine-tune the inpainting process and achieve the desired results for your images. Here are some key ADetailer parameters to understand:

Detection Model:

  • Model Type: ADetailer offers different detection models, like YOLO and MediaPipe. These models identify objects within the image. Choose the model best suited for your target object (e.g., faces, hands).
  • Confidence Threshold: This parameter sets the minimum confidence score for the detection model. A higher threshold ensures only objects with a strong likelihood of being correct are masked.
Adetailer detector model in Stable Diffusion

Model Selection:

  • The "8n" and "8s" models vary in speed and power, with "8n" being faster and smaller.
  • Opt for the model that addresses your detection needs, switching to "8s" if detection proves challenging.

Inpainting:

  • Denoising Strength: This controls the level of smoothing applied during inpainting. Lower values add more detail, but can introduce noise. Higher values create smoother results, but may reduce detail sharpness.
  • Mask Blur: This parameter controls the blur applied to the mask edges. A slight blur can help create smoother transitions between the inpainted areas and the original image.

On top of the above-mentioned parameters, ADetailer may also offer additional parameters depending on the specific interface you're using. Finding the ideal ADetailer settings depends on your desired outcome. Certainly, you can go to Adetailer github to discern more parameters about ADetailer.

In conclusion, Stable Diffusion ADetailer is a powerful tool that can significantly enhance the quality and detail of your Stable Diffusion creations. ADetailer streamlines the process of refining specific areas in your images via its inpainting and automatic masking. Whether you're a seasoned Stable Diffusion user or just starting out, ADetailer offers a valuable way to take your image generation to the next level.

With some experimentation and the help of available resources, you can unlock the full potential of ADetailer and achieve stunningly detailed and realistic outputs in your Stable Diffusion artworks. Remember, the key to mastering ADetailer lies in practice and exploring different parameter combinations to discover what works best for your creative goals.

You May Also Like

Rico Rodriguez is an experienced content writer with a deep-rooted interest in AI. He has been at the forefront of exploring generative AI tools like Stable Diffusion. His articles offer valuable insights into the world of AI, providing readers with practical tips and informative explanations.

Home > Stable Diffusion Guide > Stable Diffusion ADetailer