Nodes/CMK Flow/CMK FaceProcess -Pipe-
ComfyUI Node

CMK FaceProcess -Pipe-

Restore or re-detail the face, without the widgets you didn't ask for

By CMKFlow·Created 3 months ago·Updated 2 days ago· 6
CMK FaceProcess -Pipe-
  • FACE
  • opt_log
  • VISUAL
  • opt_diagnostic
  • IMAGE PROCEED
  • SELECTED FACE
  • SEGS PROCESSED
  • ENABLED
  • LOG
  • VISUAL
  • diagnostic
◄enabletrue►
◄process_moderestore►
◄select_faceLargest►
◄refine_modeOff►
◄detect_modelnone►
◄detect_bbox_threshold0.50►
◄detect_bbox_dilation0►
◄detect_crop_factor3.0►
◄detect_drop_size10►
◄restore_model▾►
◄restore_facedetection▾►
◄restore_visibility1.00►
◄restore_codeformer_weight0.50►
◄detail_guide_size512►
◄detail_guide_size_fortrue►
◄detail_max_size768►
◄detail_denoise80►
◄detail_noise_masktrue►
◄detail_force_inpainttrue►
◄detail_paste_feather20►

CMK FaceProcess -Pipe- is the pack's face module in its modular form: it reads the image and the mode from a FACE pipe, and its UI only shows you the settings the current mode actually uses. If you've ever stared at a face node with 25 widgets and no idea which twelve are live, that's the problem it solves.

The two modes

process_mode is restore or detailer. They are genuinely different pipelines:

  • restore runs a learned face-restoration network: detect faces, align them, run the enhancer, paste back with a soft edge, then blend by restore_visibility. It's the GFPGAN/CodeFormer-style pass, and it needs those model files plus insightface to find and align the faces.
  • detailer does the re-render loop - crop the face, upscale it to detail_guide_size (capped at detail_max_size), VAE-encode, sample it with a mask so only the face changes, decode, resize back down, paste. That's a diffusion pass per face, so the widget that matters most is detail_denoise.

Everything after enable and select_face is optional from ComfyUI's point of view, and the CMK frontend extension shows or hides blocks based on the active mode. The inactive set of values is preserved internally and restored when you switch back, which is a small thing that matters a lot when you're A/B-ing modes.

The controls worth understanding

  • FACE - the prepared context pipe from CMK FaceProcess Prepare -Pipe-.
  • enable - the local switch, on by default. It's AND-ed with the module-wide face_global_enable from the prepare node; either one off and the image passes through unchanged.
  • select_face - Largest, Leftmost, Rightmost, Topmost, Bottommost, Center or All Faces. These seven presets are this node's face selection; the ReActor-style sort/filter/take controls you'll find on the toolbox node were deliberately dropped from the pipe contract, so presets are the whole interface here.
  • refine_mode - Off, Detail, Sharpen or Smooth, applied after the mode's work as a mask-limited pixel pass at a fixed strength. Off is the default, and Off is what you want while you're tuning anything else, because it will happily mask the changes you're trying to evaluate.
  • The detect block: detect_bbox_threshold (0.5), detect_bbox_dilation, detect_crop_factor, detect_drop_size. Straight from the detector-wrapper vocabulary - threshold above which a box counts, how far to grow it, how much context around the box to keep.
  • The restore block: restore_model (from models/facerestore_models), restore_visibility, and two inherited ReActor knobs, restore_facedetection and restore_codeformer_weight. Heads up on those two: the CMK restore adapter accepts them and then discards them - the face set always comes from InsightFace's detector, and the CodeFormer weight isn't passed through. Set them and nothing changes.
  • The detail block: detail_guide_size (512), detail_guide_size_for (on = measure against the detected box, off = against the crop), detail_max_size (768), detail_noise_mask, detail_force_inpaint, detail_paste_feather (20), and detail_denoise.
  • detail_denoise default 80, range 50–100, and its tooltip says it all: "Sampling entry in percent. Later entry preserves the original face; earlier entry rebuilds it more strongly." It is not a denoise value. 80 becomes denoise 0.20 - a light touch. If you want a heavy rebuild, go down toward 50, which gives denoise 0.50.

Outputs: IMAGE PROCEED, SELECTED FACE (SEGS), SEGS PROCESSED (SEGS), ENABLED (a boolean telling you whether the pass actually ran), LOG, VISUAL and diagnostic. Wire ENABLED into downstream logic if you want a gate that respects "the face module was off"; wire VISUAL if you're using the pack's visualizer.

Install

Manager: search CMK Flow, install the CMKFlow entry, restart. Manually, from the folder holding main.py:

git clone https://github.com/CMKFlow/cmk_nodes.git custom_nodes/cmk_nodes
python3 custom_nodes/cmk_nodes/scripts/install_cmk_requirements.py

Wait for CMK dependency check: OK, then restart. The dependency load is real and shared: insightface, onnxruntime, ultralytics, segment-anything, opencv-python, imageio-ffmpeg, nudenet==3.4.2. Model files are separate - restore networks under models/facerestore_models, detectors under models/ultralytics/bbox, SAM under models/sams:

python3 custom_nodes/cmk_nodes/scripts/check_cmk_resources.py --models-root "/path/to/shared/models"

Enable ComfyUI's Vue Nodes / Nodes 2.0 setting or the mode-dependent UI won't rebuild.

Issues worth knowing

If the module looks inert, check the two switches - enable here and face_global_enable on the prepare node - and then ENABLED on the output, which is the node's own answer to "did I do anything?"

If restore mode fails at run time, it's almost always insightface or its model pack missing. The library is MIT; the pretrained ONNX weights are not, so this is the path with a licensing footnote if you're selling output.

And if you're using the detailer mode to fix a face that's simply too small in frame, no denoise setting will save you. The detailer gives the region its own resolution budget; if the face is 60 pixels wide, raise detail_guide_size and accept the extra time, or generate the frame larger.

CategoryCMK/Flow/PostProcess

Inputs (24)

NameTypeDefaultDescription
FACECMK_FACE_PIPE—
enableBOOLEANtrue—
process_modeCOMBOrestore2 options: restore, detailer
select_faceCOMBOLargest7 options: Largest, Leftmost, Rightmost, Topmost, Bottommost, Center, +1
refine_modeoptCOMBOOff4 options: Off, Detail, Sharpen, Smooth
detect_modeloptCOMBOnone1 options: none
detect_bbox_thresholdoptFLOAT0.500–1—
detect_bbox_dilationoptINT0-512–512—
detect_crop_factoroptFLOAT3.01–100—
detect_drop_sizeoptINT101–8192—
restore_modeloptCOMBO1 options: none
restore_facedetectionoptCOMBO4 options: retinaface_resnet50, retinaface_mobile0.25, YOLOv5l, YOLOv5n
restore_visibilityoptFLOAT1.000–1—
restore_codeformer_weightoptFLOAT0.500–1—
detail_guide_sizeoptFLOAT51264–8192—
detail_guide_size_foroptBOOLEANtrue—
detail_max_sizeoptFLOAT76864–8192—
detail_denoiseoptFLOAT8050–100Sampling entry in percent. Later entry preserves the original face; earlier entry rebuilds it more strongly.
detail_noise_maskoptBOOLEANtrue—
detail_force_inpaintoptBOOLEANtrue—
detail_paste_featheroptINT200–200—
opt_logoptCMK_LOG_PIPE—
VISUALoptCMK_VISUAL_PIPE—
opt_diagnosticoptCMK_DIAGNOSTIC—

Outputs (7)

NameTypeDescription
IMAGE PROCEEDIMAGE—
SELECTED FACESEGS—
SEGS PROCESSEDSEGS—
ENABLEDBOOLEAN—
LOGCMK_LOG_PIPE—
VISUALCMK_VISUAL_PIPE—
diagnosticCMK_DIAGNOSTIC—