ArtificialGuyBR

Home / Blog / Fixing things

Fix Faces and Hands with ADetailer and FaceDetailer

Compare ADetailer for A1111/Forge and FaceDetailer for ComfyUI — automatic inpainting that detects faces, hands, and persons.

10 sources cited Fixing things

Fix Faces and Hands with ADetailer and FaceDetailer

TL;DR

How Automatic Detailers Replace Manual Inpainting

Manual inpainting requires sending an image to the Inpaint tab, brushing a mask, and generating — ADetailer and FaceDetailer eliminate those steps. A detection model finds the region, builds the mask, and runs inpainting in one pass.

ADetailer documentation describes its workflow as three steps: create an image, detect objects and create a mask image, then inpaint using the image and mask (Bing-su/adetailer README). FaceDetailer follows the same pattern in ComfyUI: an UltralyticsDetectorProvider produces bounding boxes, an optional SAMLoader refines them into silhouettes, and a Detailer node upscales only the cropped region (ComfyUI-Impact-Pack README).

The practical difference: ADetailer exposes the pipeline as UI tabs; FaceDetailer exposes it as nodes you wire. Both let you run multiple detectors — face and hand, or face and person — so a single generation fixes several problem areas at once.

ADetailer in Automatic1111 and Forge

Supported Models and What They Detect

ADetailer ships with YOLOv8 detection models. Key models and their detection targets:

ModelTargetmAP@50mAP@50-95Source
face_yolov8n.pt2D / realistic face0.6600.366HF/Bingsu/adetailer
face_yolov8s.pt2D / realistic face0.7130.404HF/Bingsu/adetailer
hand_yolov8n.pt2D / realistic hand0.7670.505HF/Bingsu/adetailer
hand_yolov8s.pt2D / realistic hand0.7940.527HF/Bingsu/adetailer
person_yolov8n-seg.pt2D / realistic person0.782 / 0.7610.555 / 0.460HF/Bingsu/adetailer
person_yolov8s-seg.pt2D / realistic person0.824 / 0.8090.605 / 0.508HF/Bingsu/adetailer

Full table with all variants (face_yolov8m.pt, face_yolov9c.pt, hand_yolov9c.pt, person_yolov8m-seg.pt) is at Bingsu/adetailer. Three MediaPipe face models (full, short, mesh) are also available but report no mAP figures. Put any .pt file from Ultralytics into models/adetailer and ADetailer will list it automatically.

Key Settings and What They Do

ParameterDefaultRangePurpose
Detection confidence0.30.0–1.0Minimum score for a detection to trigger inpainting; lower = more detections
Mask min / max ratio0.0 / 1.00.0–1.0Filter masks by relative area; raise min to ignore tiny objects
Mask only top k largest0 (disabled)integerKeep only the k biggest bounding boxes
Dilate / erode+4integer (px)Expand (positive) or shrink (negative) the mask before inpainting
X / Y offset0integer (px)Nudge the mask horizontally or vertically
Mask merge modeNoneNone / Merge / Merge and InvertCombine multiple masks into one inpainting pass
Inpaint denoising strength0.40.0–1.0How much the inpainted region may change; lower = closer to original
Inpaint only maskedOnbooleanRestrict diffusion to masked pixels; recommended for faces
Inpaint padding32integer (px)Context pixels around the mask fed to the sampler
ControlNet modelNoneinpaint, scribble, lineart, openpose, tile, depthAdds structural guidance during inpainting; preprocessor auto-selected

All defaults come from the ADetailer args schema in adetailer/args.py. The ThinkDiffusion guide notes that lower threshold values (e.g., 0.3) are advisable for detecting faces; raise it if you get false positives on background textures (ThinkDiffusion guide).

Key Settings and What They Do

ParameterDefaultRangePurpose
Detection confidence0.30.0–1.0Minimum score for a detection to trigger inpainting; lower = more detections
Mask min / max ratio0.0 / 1.00.0–1.0Filter masks by relative area; raise min to ignore tiny objects
Mask only top k largest0 (disabled)integerKeep only the k biggest bounding boxes
Dilate / erode+4integer (px)Expand (positive) or shrink (negative) the mask before inpainting
X / Y offset0integer (px)Nudge the mask horizontally or vertically
Mask merge modeNoneNone / Merge / Merge and InvertCombine multiple masks into one inpainting pass
Inpaint denoising strength0.40.0–1.0How much the inpainted region may change; lower = closer to original
Inpaint only maskedOnbooleanRestrict diffusion to masked pixels; recommended for faces
Inpaint padding32integer (px)Context pixels around the mask fed to the sampler
ControlNet modelNoneinpaint, scribble, lineart, openpose, tile, depthAdds structural guidance during inpainting; preprocessor auto-selected

All defaults come from the ADetailer args schema in adetailer/args.py. The ThinkDiffusion guide notes lower threshold values (e.g., 0.3) are advisable for detecting faces; raise it if you get false positives on background textures (ThinkDiffusion guide).

[Load Image] → [UltralyticsDetectorProvider(bbox/face_yolov8m.pt)] → [BBox Detector] → [FaceDetailer] → [Preview/Save]

Add a SAMLoader and SAMDetector (combined) between the BBox Detector and FaceDetailer to swap rectangular boxes for precise silhouettes. The Impact Pack README documents this combination: the BBox detector finds faces, the SAM detector extracts the segment related to each face, and a Segs & Mask node intersects the two masks so only the facial contour is enhanced (Impact Pack README). The detector tutorial explains that SAMLoader (Impact) loads the SAM model used by this chain (detectors tutorial).

Multi-Pass (2Pass) Workflow

Wire a second FaceDetailer (pipe) after the first. The first pass uses moderate settings to rebuild the basic outline; the second pass refines detail. The Impact Pack README describes FaceDetailer (pipe) as the variant built "for multipass" — it bundles model, VAE, and conditioning into a single DETAILER_PIPE so you don't repeat inputs (Impact Pack README).

AnimateDiff / Video Support

The Impact Pack detailer tutorial lists Detailer For AnimateDiff and SEGSDetailer For AnimateDiff nodes for enhancing frames in AnimateDiff workflows (detailers tutorial).

When to Use Detailers Instead of Manual Inpainting

SituationManual InpaintingADetailer / FaceDetailer
One or two obvious flaws per imageFast, full controlOverhead not worth it
Batch of 50+ images with similar flawsImpracticalOne-click per image or full batch
Faces smaller than ~64 px in the frameHard to mask accuratelyDetection model finds them reliably
Hands + faces both need fixingTwo separate mask passesTwo detector tabs / nodes in one run
Need exact same mask across frames (video)Nearly impossibleSimple Detector for Video + pivot mask
Want to keep background untouchedEasy with careful brushingRequires SAM + BBox intersection

Rule of thumb: if you would open the Inpaint tab more than three times in a session, a detailer pays for its setup time.

Common Errors and Fixes

SymptomCauseFix
Garbled faces at 512×512 or lowerToo few pixels in the face region for the base modelEnable ADetailer or FaceDetailer; the detailer upscales the crop to guide_size before inpainting
Distorted hands in full-body shotsBase model lacks hand training dataAdd a second ADetailer tab with hand_yolov8n.pt or a second FaceDetailer fed by a hand detector
Enhancement bleeds into backgroundRectangular bbox mask includes shoulders/hairInsert SAMLoader + SAMDetector (combined) and intersect with BBox mask via Segs & Mask
ReActor: AttributeError: 'NoneType' object has no attribute 'get'Corrupted or missing inswapper_128.onnxRe-download from HuggingFace datasets/Gourieff/ReActor and replace in ComfyUI/models/insightface/ (ReActor README)
ReActor Masking Helper finds no facesMissing face_yolov8m.pt or SAM modelPut face_yolov8m.pt in ComfyUI/models/ultralytics/bbox/ and sam_vit_b_01ec64.pth in ComfyUI/models/sams/ (ReActor README)
ADetailer: "img2img inpainting with skip img2img is not supported"Skip img2img enabled on an img2img inpaint taskDisable Skip img2img in ADetailer options when using img2img mode

FAQ

What detection confidence threshold should I use for face detection in ADetailer? Start at the default 0.3. Lower (e.g., 0.2) catches more faces — including false positives on textures. Raise (e.g., 0.5) if background objects get inpainted.

How many ADetailer models can I run simultaneously? Two tabs by default. Change the ad_max_models option in WebUI settings to allow more; each additional model adds a full detect → mask → inpaint pass.

Why do I need SAM for FaceDetailer? Bounding boxes are rectangles; faces are not. SAM converts each box into a silhouette that hugs the jawline and hairline, so the inpainting stays inside the face.

What's the difference between ADetailer and manual inpainting? Manual inpainting lets you place the mask exactly where you want. ADetailer places it where a detector thinks the object is. For faces and hands at low resolution, the detector is usually more consistent than a hurried brush stroke.

Can ADetailer fix eyes specifically? No dedicated eye model ships with ADetailer. The face models cover the whole facial region; eye detail improves as a side effect of the face inpainting pass.

How do I update the YOLO models when new versions release? Re-download the .pt files from huggingface.co/Bingsu/adetailer (ADetailer) or via ComfyUI-Manager's model list (Impact Pack). Overwrite the old files and restart the UI.

Sources

Internal link: automatic inpainting basics Internal link: YOLO model comparison Internal link: ComfyUI custom nodes guide Internal link: ReActor face swap tutorial Internal link: ControlNet for inpainting