ComfyUI Node

Detailer

The face detailer that hugs the face instead of boxing it

By raspie10032·Created about a year ago·Updated a day ago· 7
Detailer
  • image
  • segm_detector
  • sam_model
  • bbox_detector
  • eye_bbox_detector
  • characterPrompts
  • tagger
  • image
  • mask_visualization
  • matching_report
promptsmiling face, highly detailed
negative_promptlowres, bad anatomy
modelNAI Diffusion V5 Curated
strength0.55
threshold0.30
samplerk_euler
steps28
cfg_scale6.0
bbox_threshold0.50
dilation4
crop_factor3.0
schedulerkarras
seed-1
limit_opus_freetrue
detail_modefirst
matching_modeshared
match_min_score0.25
match_min_margin0.08
match_crop_factor2.0
max_regions16
preview_onlyfalse

The pack's other face detailer is the sibling you probably want if seams show. NAIFaceDetailerSegmNode runs the exact same detect-crop-segment-inpaint-paste loop as NAIFaceDetailerNode, with one role swap: a segmentation detector (polygon, following the face outline) is the required primary that defines the crop region, and a bbox detector is the optional additive source. You'll find it in the node list under the plain name "Detailer".

Why the swap matters: a bbox detector hands you a rectangle, and a rectangle's edges can show against the surrounding pixels after the inpaint is pasted back. A segmentation detector returns a polygon that follows the face's actual outline, so the mask hugs the subject and the seam mostly disappears. If you've tried the bbox version and see a rectangular patch, this is the one to reach for.

How it works

Same pipeline as its sibling, so this is the short version:

  1. Detect - the required segm_detector finds the first face and defines the crop region.
  2. Crop and upscale - the crop is scaled so its longest side is 1024px.
  3. Segment - SAM produces the final mask. A connected bbox_detector is an equal-layer additional source: it doesn't replace the segm detector, it contributes extra SAM input boxes whose masks get unioned in. SAM still wins the final word.
  4. Grid-ify - the mask becomes 32px boxes on an 8px stride per the threshold.
  5. Re-render - crop + mask go to NovelAI infill with your prompt, strength, sampler, steps, CFG.
  6. Paste back - the result is downscaled and pasted over the crop region.

Only the first detected face is processed. No face found → both outputs return your original image. Autosaves land under output/<date>/NAI_autosave/face/ with NAI metadata intact.

The inputs

Required: image, segm_detector, sam_model, prompt / negative_prompt (defaults smiling face, highly detailed / lowres, bad anatomy), model (the same V5/V4.5/V4/V3 dropdown), strength (default 0.55), threshold (default 0.3), sampler, steps, cfg_scale, bbox_threshold, dilation, crop_factor, scheduler, seed. Optional: bbox_detector (the additive source above), eye_bbox_detector (adds eye-region boxes - the classic "eyes are always a mess" fix), limit_opus_free.

Outputs: image (composited result) and mask_visualization (debug view of the mask).

Install

Pack via ComfyUI Manager (search ComfyUI_RS_NAI_API_Request) or clone, plus the same mandatory extras as its sibling:

cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack.git
git clone https://github.com/ltdrdata/ComfyUI-Impact-Subpack.git

The SEGM_DETECTOR and SAM_MODEL types are Impact's; you need a segmentation YOLO (a *-seg.pt detector) and a SAM checkpoint, plus NAI_ACCESS_TOKEN=... in the node's .env.

Gotchas

Same cloud-cost and single-face caveats as the bbox version - this is a cloud inpaint call per run, and it fixes the first face it finds. The thing this version buys you is the polygon: tighter masks, fewer seams, and the mask_visualization output is worth a look on your first few runs to confirm the segm detector is actually finding the face's outline and not a hat brim or collar.

CategoryRS_NovelAI_API/FaceDetailer

Inputs (28)

NameTypeDefaultDescription
imageIMAGE
segm_detectorSEGM_DETECTOR
sam_modelSAM_MODEL
promptSTRINGsmiling face, highly detailed
negative_promptSTRINGlowres, bad anatomy
modelCOMBONAI Diffusion V5 Curated8 options: NAI Diffusion V5 Curated, NAI Diffusion V5 Full, NAI Diffusion V4.5 Curated, NAI Diffusion V4.5 Full, NAI Diffusion V4 Full, NAI Diffusion V4 Curated Preview, +2
strengthFLOAT0.550–1
thresholdFLOAT0.300–1
samplerCOMBOk_euler7 options: k_dpmpp_2m, k_dpmpp_sde, k_dpmpp_2m_sde, k_dpmpp_2s_ancestral, k_euler_ancestral, k_euler, +1
stepsINT281–50
cfg_scaleFLOAT6.00–30
bbox_thresholdFLOAT0.500–1
dilationINT40–64
crop_factorFLOAT3.01–10
schedulerCOMBOkarras4 options: native, karras, exponential, polyexponential
seedINT-1-1–4294967295
bbox_detectoroptBBOX_DETECTOR
eye_bbox_detectoroptBBOX_DETECTOR
limit_opus_freeoptBOOLEANtrue
detail_modeoptCOMBOfirst2 options: first, all
matching_modeoptCOMBOshared2 options: shared, wd14
characterPromptsoptLIST
taggeroptRS_WD_TAGGER
match_min_scoreoptFLOAT0.250.01–1
match_min_marginoptFLOAT0.080.01–1
match_crop_factoroptFLOAT2.01–5
max_regionsoptINT161–64
preview_onlyoptBOOLEANfalse

Outputs (3)

NameTypeDescription
imageIMAGE
mask_visualizationIMAGE
matching_reportSTRING