ComfyUI Node

Yolov8DSUKsampler

One node that finds the faces, fixes each one, and walks away

By dskjal·Created 10 months ago·Updated 7 months ago· 0
Yolov8DSUKsampler
  • image
  • model
  • vae
  • positive
  • negative
  • Image
  • model pass through
  • vae pass through
  • negative pass through
  • debug detected area
  • debug mask
yolo_model_name
padding_pixel0
threshold0.30
upscale_method
scale_pixel_to1024
noise_seed0
steps20
cfg8.0
sampler_name
scheduler
denoise1.00
edge_blur_pixel64
mask_blur_pixel4

The name is a mouthful, but the job is dead simple: YOLO finds the people in your render, the node re-renders each one on its own at proper resolution, then stitches it back into the frame. It's ADetailer-style detect-and-inpaint - the thing that made ruined faces a solved problem over on A1111 - compressed into a single ComfyUI node that needs no extra wiring. Point it at a YOLO model, feed it your checkpoint and prompts, and it fixes faces, hands, and small parts automatically.

Why it exists

The author (dskjal) shipped a simpler detection-and-composite node first, and it hit two walls: when YOLO detected nothing, it couldn't skip the sampling phase, and when it detected several people, it only acted on one. This node exists specifically to solve those two cases. Nothing detected means the image passes straight through untouched - no wasted sampling, no crash. Multiple detections mean each box gets its own full sampling pass, one after another, and each result is composited back into the original before the next one runs.

Mechanically, for every box above the confidence threshold it crops the region, pads it if you ask, upscales the crop to a useful generation resolution, VAE-encodes it, runs a complete KSampler pass with your positive/negative conditioning, decodes, downscales back to the original crop size, and blends it in with a blurred alpha edge. That's the whole "upscale, sample, composite" in the name, matching the crop-and-stitch pattern the community converged on - only masked pixels ever pass through VAE encode/decode, so the untouched frame stays bit-identical.

The inputs that matter

The ones you actually touch:

  • yolo_model_name - dropdown of .pt files sitting in ComfyUI/models/yolov8. Blank until you drop a model in there (more below).
  • threshold (default 0.3) - detections below this confidence are skipped. If something's being ignored, check the debug detected area output to see the scores YOLO actually assigned.
  • padding_pixel (default 0) - adds margin around the detected box. The README's example is eyes, hands, and the rest of those small regions that get clipped without it. 32–64px is the usual zone.
  • scale_pixel_to (default 1024) - the target for the crop's shorter side after upscaling. This is your detail knob: bigger means the face gets more latent budget, slower but crisper.

Then the sampler block, which is just a KSampler wearing a trench coat: model, vae, positive, negative, steps (20), cfg (8), sampler_name, scheduler, denoise (1.0), and noise_seed. Two extra blend knobs worth knowing: edge_blur_pixel (64) feathers the seam around the composite so a patch doesn't look pasted on, and mask_blur_pixel (4) softens the mask itself.

Outputs

The Image output is your final, composited frame. The model pass through, vae pass through, and negative pass through outputs just relay what you fed in - handy for chaining, since this node doesn't expose a latent. debug detected area is YOLO's annotated plot with boxes and confidence scores drawn on, and debug mask is the mask that got used - the two sockets you reach for when a fix isn't landing.

Install

ComfyUI Manager is the easy road: search comfyui-yolov8-dsuksampler and hit install. Or clone it manually:

cd ComfyUI/custom_nodes
git clone https://github.com/dskjal/comfyui-yolov8-dsuksampler

Then restart ComfyUI. The catch that trips everyone: you must supply the YOLO weights yourself. Manager won't fetch them. Grab yolov8n.pt (detection) or yolov8n-seg.pt (segmentation) from the ultralytics releases and drop it in ComfyUI/models/yolov8. The install pulls ultralytics==8.3.224, which is a chunky dependency that pins a torch build - expect the first manager install to take a while.

Gotchas

  • The model dropdown is empty until you add a model to models/yolov8. First-time users assume the node is broken. It's just empty-handed.
  • Segmentation is hardcoded to people. If your model name contains "seg", the mask logic only processes COCO class 0 - persons. Hand it a seg model and it'll mask people, not nipples or whatever custom thing you trained; for those you want a plain detection model, which uses full-box masks instead.
  • Tiny detections are silently skipped. Crops whose upscale factor would exceed 16× get dropped with a console note, not an error - a far-away face too small to fix is left alone.
  • denoise at 1.0 fully regenerates each person. Great for replacing a botched subject, but it can drift identity and clothing. For "just clean up the face" duty, run a low denoise like 0.4 - that's the fix-the-detail use this node is best at.

Where it gives up control is per-region prompts: every detected person samples with the same conditioning. If you need different prompts per region, Impact Pack's FaceDetailer or a manual Crop + Stitch pair will bend further. This node's trade is the opposite - one node, zero wiring, handles the empty-frame and crowd cases that break the simple alternatives. For a batch fixer, that's usually the right deal.

Categoryyolov8

Inputs (18)

NameTypeDefaultDescription
imageIMAGE
yolo_model_nameCOMBO0 options:
padding_pixelINT0
thresholdFLOAT0.300–1
upscale_methodCOMBO5 options: nearest-exact, bilinear, area, bicubic, lanczos
scale_pixel_toINT1024512–2048
modelMODEL
vaeVAE
noise_seedINT00–18446744073709550000
stepsINT201–10000
cfgFLOAT8.00–100
sampler_nameCOMBO44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38
schedulerCOMBO9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3
positiveCONDITIONING
negativeCONDITIONING
denoiseFLOAT1.000.01–1
edge_blur_pixelINT64
mask_blur_pixelINT4

Outputs (6)

NameTypeDescription
ImageIMAGE
model pass throughMODEL
vae pass throughVAE
negative pass throughCONDITIONING
debug detected areaIMAGE
debug maskIMAGE