CMK Smart Detailer
Detect, crop, resample, paste back — without installing Impact Pack
- image
- basic_pipe
- sam_model_opt
- image
- segs_detected
- segs_detailed
- detailer_log
- enabled
- diagnostic
A face occupying 80×80 pixels of a 1024×1024 frame gets 80×80 worth of model attention and comes out mangled. The fix has been the same since ADetailer: find the region, crop it, run a fresh sampling pass at proper resolution, composite it back. In ComfyUI that loop is Impact Pack's FaceDetailer, and for years the answer to "how do I do this" was "install Impact Pack". CMK Smart Detailer is the same loop running on CMK's own engine - YOLO detection, native pasteback, and a BASIC_PIPE for the model instead of a foreign pack's socket types.
How the loop actually runs here
Detection goes through Ultralytics with models from ComfyUI's ultralytics_bbox and ultralytics_segm folders - the same paths Impact Pack uses, so any face_yolov8 weights you already have work as-is. The detector takes a confidence bbox_threshold (0.5), dilates the box by bbox_dilation pixels, expands it by crop_factor (3.0, i.e. three times the box size to give the sampler context), and drops anything smaller than drop_size (10 px).
Then, per detected region: the crop is resized so the short side reaches guide_size (512 by default), unless guide_size_for is off, in which case the crop region's short side is the basis instead. The long side is capped at max_size (768) and everything is rounded to a multiple of 8. That crop is VAE-encoded, optionally given a noise_mask from the segment's own mask, sampled with your steps/cfg/sampler_name/scheduler at denoise (0.5 default, hard-capped at 0.5), decoded, and resized back into the original crop rectangle. Each crop's seed is seed + index, so regions stay stable between runs. Finally the refined crops are pasted back with a feathered soft mask - SEGSPaste at feather 5, alpha 255.
Inputs and outputs
imageandbasic_pipe- the pipe is a 5-tuple of model, clip, vae, positive and negative conditioning. If you're inside a CMK Flow chain you don't build it by hand;CMK Detailer Prepare -Pipe-produces aDETAILERpipe andCMK Pipe Peek Detailerpeels thebasic_pipeoff it.
And that pipe is exactly what Impact Pack's BasicPipe node emits, so this detailer also drops into a non-CMK graph where you already have one lying around.
boolean_detailer_enable(global) andenable(local) both have to be on for anything to happen. Off means passthrough, not an error.model_name,bbox_threshold,crop_factor,denoise,seed,steps,cfgare the ones you'll actually adjust.crop_factorat 3 anddenoisearound 0.3–0.4 is where most people land; 0.5 is already a strong reinterpretation of the region.
Outputs: image (the composited result), segs_detected, segs_detailed, detailer_log (a string - handy for knowing what it found), enabled, and diagnostic.
Installing
Manager: search CMK Flow → install the CMKFlow entry → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/CMKFlow/cmk_nodes.git cmk_nodes
python3 cmk_nodes/scripts/install_cmk_requirements.py
python3 cmk_nodes/scripts/check_cmk_resources.py --models-root "/path/to/shared/models"
The resource script installs the Ultralytics detectors, SAM models and InsightFace buffalo_l directly, which saves hunting for YOLO weights. CMK needs Vue Nodes / Nodes 2.0 enabled.
Things that will annoy you
No detections is the most common outcome, and it's usually bbox_threshold too high or a detector that doesn't match your subject - a face model won't find hands, and a generic object model won't find small faces. The detailer_log output tells you what happened, so read it instead of re-rendering blindly.
Second, the honest one from the ongoing detailing debate: if the face is already large in frame, a second pass changes it without improving it. The most-upvoted reaction to a widely shared video detailing demo was that the two versions looked identical. Detailing earns its keep on the small stuff.
Third, a footnote worth knowing if you pin dependencies for anything you ship: the Ultralytics package is the route by which a December 2024 supply-chain compromise - a cryptominer in a released version of the package - reached ComfyUI users through Impact Pack. CMK requires ultralytics too. That's not a CMK bug, just a reminder that this particular dependency has history and a version pin is a reasonable precaution.
Inputs (21)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| basic_pipe | BASIC_PIPE | — | |
| boolean_detailer_enable | BOOLEAN | true | — |
| enable | BOOLEAN | true | — |
| model_name | COMBO | 0 options: | |
| bbox_threshold | FLOAT | 0.500–1 | — |
| bbox_dilation | INT | 0-512–512 | — |
| crop_factor | FLOAT | 3.01–100 | — |
| drop_size | INT | 101–8192 | — |
| guide_size | FLOAT | 51264–8192 | — |
| guide_size_for | BOOLEAN | true | — |
| max_size | FLOAT | 76864–8192 | — |
| seed | INT | 00–18446744073709550000 | — |
| steps | INT | 201–10000 | — |
| cfg | FLOAT | 8.000–100 | — |
| sampler_name | COMBO | 44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38 | |
| scheduler | COMBO | 9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3 | |
| denoise | FLOAT | 0.500.0001–0.5 | — |
| noise_mask | BOOLEAN | true | — |
| force_inpaint | BOOLEAN | true | — |
| sam_model_optopt | SAM_MODEL | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| segs_detected | SEGS | — |
| segs_detailed | SEGS | — |
| detailer_log | STRING | — |
| enabled | BOOLEAN | — |
| diagnostic | CMK_DIAGNOSTIC | — |