Nodes/Mikey Nodes/Face Fixer OpenCV (Mikey)
ComfyUI Node

Face Fixer OpenCV (Mikey)

Face Fixer OpenCV (Mikey Nodes) — a self-contained face fix without a YOLO model

By bash-j·Created 3 years ago·Updated 11 months ago· 188
Face Fixer OpenCV (Mikey)
  • image
  • base_model
  • vae
  • positive_cond_base
  • negative_cond_base
  • image
seed0
face_img_resolution1024
padding32
scale_factor1.2
min_neighbors8
denoise0.50
classifiercombined
sampler_namedpmpp_2m_sde
schedulerkarras
cfg7.0
steps30

Small, distant faces coming out mangled is one of the oldest, most structural problems in diffusion generation - the face just doesn't get enough latent pixels to resolve properly. The standard ComfyUI answer to that is Impact Pack's FaceDetailer, which detects faces with a trained YOLO model and inpaints each one at full resolution. This node solves the same problem with a much older, much lighter piece of tech: OpenCV's Haar cascade classifiers.

The mechanism, and how it differs from the usual approach

Haar cascades are a pre-deep-learning face detection algorithm that's shipped inside OpenCV for years - no separate model download required, because the classifier files come bundled with the library itself. This node runs one over your image, crops around each detection with your chosen padding and scale_factor headroom, resizes the crop to face_img_resolution, runs it through a full sampling pass with the model/vae/conditioning you feed in, and composites the result back onto the original image.

That's a meaningfully different trade-off from the YOLO-based route. YOLO detectors are trained specifically for the job and handle odd angles, partial occlusion, and stylized art much better - it's why Impact Pack's FaceDetailer is the community's default. Haar cascades are older, faster to run, need no extra model file, and can be noticeably less reliable at anything other than a roughly front-facing, well-lit face. The classifier dropdown reflects that heritage directly: alongside combined (the default, presumably layering several detectors) and an animeface option for stylized art, most of the choices are literal haarcascade_*.xml filenames - frontalface_default, profileface, frontalface_alt, even non-face options like upperbody, fullbody, frontalcatface, and hands. If detection quality on a specific image matters more than speed or simplicity, that's the honest reason to reach for Impact Pack's FaceDetailer instead.

The inputs that matter

  • image, base_model, vae, positive_cond_base, negative_cond_base - the same ingredients a normal KSampler pass needs, since this node is running a real inpainting sample internally, not just a filter.
  • classifier - which detector to use; combined is the sensible default, animeface if your source is stylized art rather than photorealistic.
  • padding (default 32) and scale_factor (default 1.2) - how much extra room the crop gets around the detected face box, which matters because too tight a crop clips hair or jaw and too loose wastes resolution on background.
  • min_neighbors (default 8) - a Haar-cascade-specific detection strictness knob; higher values mean fewer false positives but a higher chance of missing a real face, lower values catch more faces but risk detecting things that aren't faces at all.
  • denoise (default 0.5), steps, cfg, sampler_name (default dpmpp_2m_sde), scheduler (default karras) - standard sampling controls for the inpaint pass itself.

Single output: a fixed image.

Installing

Comes with the full Mikey Nodes pack - ComfyUI Manager, search "Mikey Nodes," install, restart, or cd ComfyUI/custom_nodes && git clone https://github.com/bash-j/mikey_nodes and restart manually. Because it depends on OpenCV's face detection module, make sure opencv-python (or opencv-contrib-python) actually installed correctly alongside the pack - this is the one node in the pack most likely to complain on startup if that dependency is missing or conflicting with another node's OpenCV requirement.

Where it goes wrong

  • Faces not detected at all. Haar cascades are genuinely weaker at side profiles, extreme angles, or low-contrast lighting than a modern YOLO detector - if min_neighbors at default settings misses faces, try lowering it, or switch classifiers (frontalface_alt2 behaves differently than frontalface_default in practice).
  • False positives on non-face regions. The flip side of a lenient min_neighbors - texture or shadow patterns occasionally get flagged as faces. Raise min_neighbors if this happens.
  • cv2 import errors on startup. A missing or broken OpenCV install is the most likely cause if this node (and only this node) fails to load - reinstall opencv-python in your ComfyUI environment if the console shows an import error pointing at cv2.
CategoryMikey/Utils

Inputs (16)

NameTypeDefaultDescription
imageIMAGE
base_modelMODEL
vaeVAE
positive_cond_baseCONDITIONING
negative_cond_baseCONDITIONING
seedINT00–18446744073709550000
face_img_resolutionINT1024512–2048
paddingINT320–512
scale_factorFLOAT1.20.1–10
min_neighborsINT81–100
denoiseFLOAT0.500–1
classifierCOMBOcombined11 options: animeface, combined, haarcascade_frontalface_default.xml, haarcascade_profileface.xml, haarcascade_frontalface_alt.xml, haarcascade_frontalface_alt2.xml, +5
sampler_nameCOMBOdpmpp_2m_sde44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38
schedulerCOMBOkarras9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3
cfgFLOAT7.00–1000
stepsINT301–1000

Outputs (1)

NameTypeDescription
imageIMAGE