Fixing faces and hands with a detailer
Lesson "detailer", in the group Packs and tools of the lesson list. Steps: 8.
What you will be able to do
The Impact Pack finds the faces in a finished picture and draws each one again at a larger size, so small faces come out sharp.
What you need
- It goes on from A first picture from text. The card says so; it is a hint, not a lock.
- Node packs: ComfyUI-Impact-Pack, ComfyUI-Impact-Subpack. You install them in ComfyUI yourself, then choose Sync ▸ Sync now. Until then the card says the lesson does not fit and names the pack.
- Model files the lesson checks:
- for
model_nameof UltralyticsDetectorProvider: a file whose name hasfaceorhand.
- for
- Nodes: Load Checkpoint, CLIP Text Encode (Prompt), KSampler, VAE Decode, Save Image / Preview Image, UltralyticsDetectorProvider, FaceDetailer, Save Image.
- The app downloads and installs nothing. The step texts below say which files and folders, and which ComfyUI template names them.
The steps
The words of each step, as the lesson shows them. Node names are in bold.
What a detailer does (reading)
In a full-length picture a face is small, and the model has too few pixels to draw it well. A detailer finds each face, cuts it out, enlarges it, draws it again with the same model and prompt at part of the noise, and puts it back.
It draws again the face that is there. It does not put another person's face in its place, and this lesson is not about that.
The nodes come with ComfyUI-Impact-Pack and ComfyUI-Impact-Subpack. A node pack runs other people's code on your computer. Install it yourself through ComfyUI's manager, from its official page, and only if you trust its authors. The app installs nothing.
The lesson adds three nodes to the graph of "A first picture from text".
A picture graph is needed
This lesson goes on from the graph of "A first picture from text". The canvas must have Load Checkpoint, the two texts CLIP Text Encode (Prompt) and CLIP Text Encode (Prompt), KSampler, VAE Decode and Save Image with the links between them.
If they are not there, do that lesson first.
Load a face detector
Add a UltralyticsDetectorProvider node and choose
bbox/face_yolov8m.ptin itsmodel_namefield. ComfyUI keeps the detectors inmodels/ultralytics/bbox.A ".pt" file can run code when it is loaded: take it only from the page the pack names.
Add the detailer
Add a FaceDetailer node and connect to it:
image: the output of VAE Decode;model,clipandvae: the outputs of Load Checkpoint, through the LoRA loaders when there are any;positiveandnegative: the two texts;bbox_detector: theBBOX_DETECTORoutput of UltralyticsDetectorProvider.
The detailer has a sampler inside: it draws with the same model and words as the picture.
Set how much to draw again
Leave
denoiseof FaceDetailer at 0.5.At 0.5 the face keeps its features and gets sharp eyes and skin. Above 0.6 it may turn into another face.
guide_sizeis the size a face is enlarged to before drawing: 512 for SD 1.5, 1024 for SDXL.Save the fixed picture
Add a Save Image node and connect the
imageoutput of FaceDetailer to itsimagesinput. Compare it with the picture before.Hands, and finer masks (reading)
- For hands choose
bbox/hand_yolov8s.ptin UltralyticsDetectorProvider, or put a second detailer after the first: one for faces, one for hands. - A SAMLoader node at
sam_model_optmakes the mask follow the outline of the face instead of a box: fewer seams. - Hands with wrong fingers are often beyond a detailer: draw them again with inpainting or ControlNet.
- For hands choose
The graph is ready (reading)
Save the graph with "File ▸ Save workflow for ComfyUI…", open the file in ComfyUI and run it there. This app runs nothing in ComfyUI itself.
What to try: a picture of several people far away; the detailer should fix every face.
What the lesson checks
A reading step is done when you press Got it, next. A doing step ticks itself off when the canvas holds:
- Step 2, A picture graph is needed:
- a Load Checkpoint node.
- a CLIP Text Encode (Prompt) node.
- a CLIP Text Encode (Prompt) node.
- a KSampler node.
- a VAE Decode node.
- a Save Image or Preview Image node.
CLIPof Load Checkpoint intoclipof CLIP Text Encode (Prompt) (prompt) (a Load LoRA or CLIP Set Last Layer in between is accepted).CLIPof Load Checkpoint intoclipof CLIP Text Encode (Prompt) (negative prompt) (a Load LoRA or CLIP Set Last Layer in between is accepted).MODELof Load Checkpoint intomodelof KSampler (a Load LoRA or LoraLoaderModelOnly or DifferentialDiffusion or ModelSamplingAuraFlow or ModelSamplingFlux or CFGNorm or IPAdapter Unified Loader or IPAdapter or IPAdapterAdvanced or IPAdapterStyleComposition in between is accepted).CONDITIONINGof CLIP Text Encode (Prompt) (prompt) intopositiveof KSampler (a Apply ControlNet or InpaintModelConditioning or Conditioning (Combine) or ConditioningSetArea or ConditioningSetAreaPercentage or ConditioningSetMask or Apply Style Model or FluxGuidance or ConditioningZeroOut or FluxKontextMultiReferenceLatentMethod in between is accepted).CONDITIONINGof CLIP Text Encode (Prompt) (negative prompt) intonegativeof KSampler (a Apply ControlNet or InpaintModelConditioning or Conditioning (Combine) or ConditioningSetArea or ConditioningSetAreaPercentage or ConditioningSetMask or Apply Style Model or FluxGuidance or ConditioningZeroOut or FluxKontextMultiReferenceLatentMethod in between is accepted).LATENTof KSampler intosamplesof VAE Decode.VAEof Load Checkpoint intovaeof VAE Decode.IMAGEof VAE Decode intoimagesof Save Image or Preview Image (first picture).
- Step 3, Load a face detector:
- a UltralyticsDetectorProvider node.
model_nameof UltralyticsDetectorProvider holds a file whose name hasfaceorhand(capitals, dots and dashes do not matter).
- Step 4, Add the detailer:
- a FaceDetailer node.
IMAGEof VAE Decode intoimageof FaceDetailer.MODELof Load Checkpoint intomodelof FaceDetailer (a Load LoRA or LoraLoaderModelOnly or DifferentialDiffusion or ModelSamplingAuraFlow or ModelSamplingFlux or CFGNorm or IPAdapter Unified Loader or IPAdapter or IPAdapterAdvanced or IPAdapterStyleComposition in between is accepted).CLIPof Load Checkpoint intoclipof FaceDetailer (a Load LoRA or CLIP Set Last Layer in between is accepted).VAEof Load Checkpoint intovaeof FaceDetailer.CONDITIONINGof CLIP Text Encode (Prompt) (prompt) intopositiveof FaceDetailer (a Apply ControlNet or InpaintModelConditioning or Conditioning (Combine) or ConditioningSetArea or ConditioningSetAreaPercentage or ConditioningSetMask or Apply Style Model or FluxGuidance or ConditioningZeroOut or FluxKontextMultiReferenceLatentMethod in between is accepted).CONDITIONINGof CLIP Text Encode (Prompt) (negative prompt) intonegativeof FaceDetailer (a Apply ControlNet or InpaintModelConditioning or Conditioning (Combine) or ConditioningSetArea or ConditioningSetAreaPercentage or ConditioningSetMask or Apply Style Model or FluxGuidance or ConditioningZeroOut or FluxKontextMultiReferenceLatentMethod in between is accepted).BBOX_DETECTORof UltralyticsDetectorProvider intobbox_detectorof FaceDetailer.
- Step 5, Set how much to draw again:
denoiseof FaceDetailer is from 0.3 to 0.6; Do this for me sets 0.5.
- Step 6, Save the fixed picture:
- a Save Image node.
imageof FaceDetailer intoimagesof Save Image (fixed picture).