Portrait of Michael Limberger

Michael Limberger

Need me? Email mike@limberger.ca

AI

Bonus: Adetailer

A second pass on faces

ADetailer (After Detailer) is an extension that automatically fixes faces and hands, the two things AI struggles with most.

What it does

After the main image generates, ADetailer scans for faces (or hands, or other body parts), draws a box around each one it finds, regenerates just that area with more detail, and blends the fixed version back in.

It is like having an automatic touch-up artist.

Why you might want it

Even with good prompts and (symmetrical eyes)1.33, you will still get one eye slightly larger than the other, weird pupil shapes, extra fingers or fused fingers, and blurry facial features in group shots.

ADetailer catches these and fixes them automatically.

Installing it

In the A1111 WebUI: Extensions tab, Available sub-tab, click Load from to refresh the list, search for adetailer, click Install. Then Installed tab, Apply and restart UI.

Show me. Or clone it by hand.

cd stable-diffusion-webui/extensions
git clone https://github.com/Bing-su/adetailer.git

The detection models

ADetailer uses YOLO (You Only Look Once) models to find things. YOLO is a fast object detector.

face_yolov8n.pt finds faces. The n means nano: fast and lightweight. This is your default. Works great.

face_yolov8s.pt is small: slightly more accurate, slightly slower. hand_yolov8n.pt finds hands. Useful, but hands are harder to fix than faces. person_yolov8n-seg.pt finds whole people. Good for fixing body proportions.

Start with face_yolov8n. Add hand detection later if you are getting consistent hand problems.

Settings we actually use

Model: face_yolov8n.pt.

ADetailer prompt:

(perfect eyes:1.3), (detailed eyes:1.3), beautiful eyes, symmetrical eyes, detailed face, sharp focus

That prompt tells ADetailer what to focus on when it regenerates the face. We are specifically asking for better eyes. Notice the colon syntax here: ADetailer's own inpaint path still likes (tag:1.3).

Detection confidence 0.3: how sure it needs to be that it found a face. 0.3 catches most faces without false positives.

Dilate/Erode 4 expands the detection box slightly so it catches the whole face plus a little margin for blending. Mask blur 4 softens the edge of the inpainted area so it blends smoothly.

Denoising strength 0.4: how much ADetailer can change the detected area. Moderate. Fixes problems but does not dramatically alter the character. Inpaint only masked: ON. Only regenerates the detected face, not the whole image. Leave this on. Inpaint padding 48 extra pixels around the detected area for context.

Separate settings

ADetailer can use different generation settings than your main image. Face details benefit from different values.

Use separate steps: ON, ADetailer steps 28. More steps than some base generations, extra refinement on the face. Separate CFG: ON, 5.0. Slightly lower CFG for more natural facial features. Separate CLIP skip: ON, 2. Matches our models.

Copy-paste block

Show me. If you just want to match this setup.

Model:               face_yolov8n.pt
Prompt:              (perfect eyes:1.3), (detailed eyes:1.3), beautiful eyes, symmetrical eyes, detailed face, sharp focus
Confidence:          0.3
Dilate/Erode:        4
Mask blur:           4
Denoising:           0.4
Inpaint only masked: ON
Inpaint padding:     48
Separate steps:      ON, 28 steps
Separate CFG:        ON, 5.0
Separate CLIP skip:  ON, 2

When to turn it on

Good candidates: portraits where eyes need to be perfect, images with hands visible (use hand_yolov8n.pt), group shots with multiple faces, full body shots where faces are small.

Skip it for abstract art, images without people, and when you are just exploring. It slows things down.

Time cost

Detection pass is about 1 to 2 seconds. Per-face inpainting is about 10 to 20 seconds with our settings.

If you are generating lots of test images, turn it off until you find a composition you like. Then enable it for the final render.

A working loop

Generate without ADetailer to find a good composition. Note the seed of an image you like. Enable ADetailer with the settings above. Regenerate with the same seed. Compare. The face should be cleaner, especially the eyes.

If eyes or expression changed too much, lower denoising strength to 0.3 or even 0.2.

Stacking detectors

You can run multiple detectors in sequence. First ADetailer: face_yolov8n.pt (fixes face). Second: hand_yolov8n.pt (then fixes hands).

Each one runs after the previous, so faces get fixed first, then hands get fixed on the face-corrected image. Enable "2nd" in the ADetailer panel to add another detector.

When it breaks

"ADetailer keeps changing my character's expression": lower denoising strength to 0.2-0.3.

"It's not detecting faces": lower the confidence threshold to 0.2. Make sure faces are large enough in the image.

"It's detecting things that aren't faces": raise the confidence threshold to 0.4-0.5.

Patchy inpaint: increase mask blur to 8-12 for smoother blending. Increase inpaint padding to 64.

Where to read more

GitHub: github.com/Bing-su/adetailer. The wiki there has detailed settings.