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.
On this page
Fix Faces and Hands with ADetailer and FaceDetailer
TL;DR
- ADetailer (A1111/Forge) and FaceDetailer (ComfyUI) both automate the detect → mask → inpaint loop so you never draw a mask by hand.
- ADetailer runs inside the WebUI with up to two model tabs (default), configurable via
ad_max_models; FaceDetailer lives in the Impact Pack and requires the separate Impact Subpack for YOLO detection. - Both tools support YOLOv8 models for faces, hands, and persons, plus SAM for precise segmentation that keeps enhancements aligned to facial contours.
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:
| Model | Target | mAP@50 | mAP@50-95 | Source |
|---|---|---|---|---|
| face_yolov8n.pt | 2D / realistic face | 0.660 | 0.366 | HF/Bingsu/adetailer |
| face_yolov8s.pt | 2D / realistic face | 0.713 | 0.404 | HF/Bingsu/adetailer |
| hand_yolov8n.pt | 2D / realistic hand | 0.767 | 0.505 | HF/Bingsu/adetailer |
| hand_yolov8s.pt | 2D / realistic hand | 0.794 | 0.527 | HF/Bingsu/adetailer |
| person_yolov8n-seg.pt | 2D / realistic person | 0.782 / 0.761 | 0.555 / 0.460 | HF/Bingsu/adetailer |
| person_yolov8s-seg.pt | 2D / realistic person | 0.824 / 0.809 | 0.605 / 0.508 | HF/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
| Parameter | Default | Range | Purpose |
|---|---|---|---|
| Detection confidence | 0.3 | 0.0–1.0 | Minimum score for a detection to trigger inpainting; lower = more detections |
| Mask min / max ratio | 0.0 / 1.0 | 0.0–1.0 | Filter masks by relative area; raise min to ignore tiny objects |
| Mask only top k largest | 0 (disabled) | integer | Keep only the k biggest bounding boxes |
| Dilate / erode | +4 | integer (px) | Expand (positive) or shrink (negative) the mask before inpainting |
| X / Y offset | 0 | integer (px) | Nudge the mask horizontally or vertically |
| Mask merge mode | None | None / Merge / Merge and Invert | Combine multiple masks into one inpainting pass |
| Inpaint denoising strength | 0.4 | 0.0–1.0 | How much the inpainted region may change; lower = closer to original |
| Inpaint only masked | On | boolean | Restrict diffusion to masked pixels; recommended for faces |
| Inpaint padding | 32 | integer (px) | Context pixels around the mask fed to the sampler |
| ControlNet model | None | inpaint, scribble, lineart, openpose, tile, depth | Adds 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
| Parameter | Default | Range | Purpose |
|---|---|---|---|
| Detection confidence | 0.3 | 0.0–1.0 | Minimum score for a detection to trigger inpainting; lower = more detections |
| Mask min / max ratio | 0.0 / 1.0 | 0.0–1.0 | Filter masks by relative area; raise min to ignore tiny objects |
| Mask only top k largest | 0 (disabled) | integer | Keep only the k biggest bounding boxes |
| Dilate / erode | +4 | integer (px) | Expand (positive) or shrink (negative) the mask before inpainting |
| X / Y offset | 0 | integer (px) | Nudge the mask horizontally or vertically |
| Mask merge mode | None | None / Merge / Merge and Invert | Combine multiple masks into one inpainting pass |
| Inpaint denoising strength | 0.4 | 0.0–1.0 | How much the inpainted region may change; lower = closer to original |
| Inpaint only masked | On | boolean | Restrict diffusion to masked pixels; recommended for faces |
| Inpaint padding | 32 | integer (px) | Context pixels around the mask fed to the sampler |
| ControlNet model | None | inpaint, scribble, lineart, openpose, tile, depth | Adds 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
| Situation | Manual Inpainting | ADetailer / FaceDetailer |
|---|---|---|
| One or two obvious flaws per image | Fast, full control | Overhead not worth it |
| Batch of 50+ images with similar flaws | Impractical | One-click per image or full batch |
| Faces smaller than ~64 px in the frame | Hard to mask accurately | Detection model finds them reliably |
| Hands + faces both need fixing | Two separate mask passes | Two detector tabs / nodes in one run |
| Need exact same mask across frames (video) | Nearly impossible | Simple Detector for Video + pivot mask |
| Want to keep background untouched | Easy with careful brushing | Requires 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
| Symptom | Cause | Fix |
|---|---|---|
| Garbled faces at 512×512 or lower | Too few pixels in the face region for the base model | Enable ADetailer or FaceDetailer; the detailer upscales the crop to guide_size before inpainting |
| Distorted hands in full-body shots | Base model lacks hand training data | Add a second ADetailer tab with hand_yolov8n.pt or a second FaceDetailer fed by a hand detector |
| Enhancement bleeds into background | Rectangular bbox mask includes shoulders/hair | Insert SAMLoader + SAMDetector (combined) and intersect with BBox mask via Segs & Mask |
ReActor: AttributeError: 'NoneType' object has no attribute 'get' | Corrupted or missing inswapper_128.onnx | Re-download from HuggingFace datasets/Gourieff/ReActor and replace in ComfyUI/models/insightface/ (ReActor README) |
| ReActor Masking Helper finds no faces | Missing face_yolov8m.pt or SAM model | Put 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 task | Disable 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
- ADetailer repository: https://github.com/Bing-su/adetailer
- ADetailer model card (mAP tables): https://huggingface.co/Bingsu/adetailer
- ComfyUI Impact Pack: https://github.com/ltdrdata/ComfyUI-Impact-Pack
- Impact Pack detector tutorial: https://github.com/ltdrdata/ComfyUI-extension-tutorials/blob/Main/ComfyUI-Impact-Pack/tutorial/detectors.md
- Impact Pack detailer tutorial: https://github.com/ltdrdata/ComfyUI-extension-tutorials/blob/Main/ComfyUI-Impact-Pack/tutorial/detailers.md
- ComfyUI Manager metadata: https://github.com/ltdrdata/ComfyUI-Manager
- ReActor face swap nodes: https://github.com/Gourieff/ComfyUI-ReActor
- ThinkDiffusion ADetailer guide: https://learn.thinkdiffusion.com/adetailer-after-detailer-your-automatic-image-enhancement-tool/
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