Nodes/DZ-FaceDetailer/DZ_Face_Detailer
ComfyUI Node

DZ_Face_Detailer

The whole face-repair loop in one node, before Impact made it a franchise

By nicofdga·Created 3 years ago·Updated 2 years ago· 233
DZ_Face_Detailer
  • model
  • positive
  • negative
  • latent_image
  • vae
  • LATENT
  • MASK
seed0
steps20
cfg8.0
sampler_name
scheduler
denoise1.00
mask_blur0
mask_type
mask_control
dilate_mask_value3
erode_mask_value3

Faces come out mangled for a structural reason, not because your checkpoint is bad. A face that occupies 60x60 pixels of a 1024-wide render gets 60x60 worth of latent budget, so it melts into a smudge no matter how good the model is. ADetailer in A1111 made the fix a checkbox: detect every face, mask each one, and run a fresh sampling pass on the region. DZ_Face_Detailer is a ComfyUI take on that exact loop, crammed into a single node.

It's the "one box, no extra graph" version of the idea. Where Impact Pack's FaceDetailer is the famous, heavily-tooled implementation - detect, crop, upscale, resample, paste back, with SEGS and a dozen companion nodes - this one does detect, mask, and in-place re-sampling all inside DZ_Face_Detailer. It's a renamed fork of daxthin's late-2023 original (the pack is nicofdga/DZ-FaceDetailer, and if you spot the README pointing at the upstream repo, that's the fork showing), and it's genuinely the thing to reach for when you want a working face detailer without adopting Impact Pack's whole machinery.

How it actually works

The source is refreshingly small. You hand it a latent_image and a vae; it decodes the latent to pixels, runs detection on the generated image, builds a mask, then calls a standard KSampler pass on the original latent with that mask set as its noise_mask.

Two detectors, selectable via mask_type:

  • box - YOLOv8n finds each face, and the node draws a square around it (squashed to 1:1, in fact).
  • face - same YOLO pass first, but the crop then goes through Google's MediaPipe FaceMesh to trace the actual face contour, which it fills as the mask. More precise edges, slightly slower.

Either way, the mask is set so the sampler fully renoises the face region (denoise defaults to 1.0) while leaving everything outside it untouched. That's the whole trick - and note it's an in-place pass at your latent's resolution, not Impact's crop-and-upscale. On small faces in a big frame the improvement can be modest for exactly that reason; this fixes broken faces, it doesn't manufacture detail that was never there.

The inputs that matter

The full KSampler lineup is there - model, seed, steps, cfg, sampler_name, scheduler, positive, negative, denoise - and you'd normally just wire up the same values your main generation used. Three things are worth your attention:

  • latent_image + vae - it wants a latent, not an image. If you're fixing an existing PNG, VAE-Encode it first.
  • mask_control / dilate_mask_value / erode_mask_value - grow or shrink the mask before sampling. The trap: the labels are swapped in the code (the author's own comments admit the mask is inverted and "later I will fix it"). If dilate feels like it's eroding, you're not imagining it.
  • mask_blur - a small value softens mask edges so the repair doesn't leave a hard seam.

Outputs are LATENT (feed it straight to a VAE Decode) and MASK (the noise mask, if you want to preview or reuse it).

Installing it

ComfyUI Manager, search "DZ-FaceDetailer", install, restart. Or the manual way:

cd ComfyUI/custom_nodes
git clone https://github.com/nicofdga/DZ-FaceDetailer

Heads-up: this pack installs its own deps (mediapipe, ultralytics) via pip at first import, and on startup it auto-downloads the same face_yolov8n.pt from Bingsu's ADetailer repo that Impact Pack uses - into ComfyUI/models/dz_facedetailer/yolo/. Slow first launch is normal.

What gets people

Beyond the swapped dilate/erode, the two real complaints are both about that auto-install. First, no version pin on ultralytics - that's the package behind the December 2024 cryptominer supply-chain incident that reached ComfyUI through Impact Pack, so it's a genuinely good habit to pip install -U ultralytics and sanity-check after updates. Second, the import-time pip call can quietly fight your environment on some installers. If the node errors at load, delete the custom_nodes/DZ-FaceDetailer folder and re-clone clean.

It's old, it's a fork, and it isn't the standard - Impact Pack is. But if you want the ADetailer loop as a single plug-in node and don't mind its quirks, it works.

Categoryface_detailer

Inputs (16)

NameTypeDefaultDescription
modelMODEL
seedINT00–18446744073709550000
stepsINT201–10000
cfgFLOAT8.00–100
sampler_nameCOMBO42 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +36
schedulerCOMBO9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3
positiveCONDITIONING
negativeCONDITIONING
latent_imageLATENT
denoiseFLOAT1.000–1
vaeVAE
mask_blurINT00–100
mask_typeCOMBO2 options: face, box
mask_controlCOMBO3 options: dilate, erode, disabled
dilate_mask_valueINT30–100
erode_mask_valueINT30–100

Outputs (2)

NameTypeDescription
LATENTLATENT
MASKMASK