Nodes/VRGameDevGirl Video Enhancement Nodes/VRGDG Modern Face Crop (DNN)
ComfyUI Node

VRGDG Modern Face Crop (DNN)

Find the face in a wide shot, crop it cleanly, and remember where it was

By vrgamegirl19·Created about a year ago·Updated about 7 hours ago· 718
VRGDG Modern Face Crop (DNN)
  • image
  • cropped_face
  • crop_data
  • detection_confidence
model_rangefull_range
confidence0.70
crop_padding_factor0.40
minimum_face_pixels24
face_selection

Every AI video face-repair pipeline has the same shape: find the face, crop it tight, fix the crop, paste it back. The middle step is where pipelines die - a sloppy crop gets a worse result from the enhancer than no enhancement at all. VRGDG Modern Face Crop (DNN) is the pack's face finder: OpenCV's DNN face detector with confidence filtering, tiled scanning so it can actually catch small faces in wide shots, and - the part that makes the whole Face Fix workflow work - WAS-compatible CROP_DATA output so the crop can be composited back exactly where it came from.

How it works

The detection runs on OpenCV's DNN face model, with model_range toggling between full_range and short_range detection modes. confidence (default 0.7) sets the bar for accepting a detection - too high and it misses small or angled faces, too low and it crops background noise. The tiled long-range scanning is the interesting engineering: instead of one pass over the whole image, it scans in tiles, which is what lets it find a face that's 30 pixels wide in a corner of a 2K still instead of giving up.

When it finds faces, face_selection decides which one wins: highest_confidence, largest, or closest_to_center. Then crop_padding_factor (default 0.4) expands the box around the face - that padding is what gives the enhancer context to work with, and it's the setting that most determines whether the repaired face looks natural or looks pasted. minimum_face_pixels (default 24) filters out detections smaller than that so the crop stage doesn't try to enhance a 12-pixel smudge into a face.

The three outputs tell the story: cropped_face (the IMAGE to feed your enhancer), detection_confidence (the float, handy for gating), and crop_data - the CROP_DATA structure that's WAS-compatible, meaning it plugs into the WAS Node Suite's crop/composite nodes for the paste-back. That compatibility is why this node slots into existing face-fix graphs without custom compositing glue.

The inputs that matter

  • confidence - 0.7 default; lower it for hard-to-detect faces in busy frames.
  • crop_padding_factor - how much context surrounds the crop; 0.4 is a good middle.
  • face_selection - which face wins when the shot has several.

Install

Pack-wide: ComfyUI Manager → search vrgamedev (or https://github.com/vrgamegirl19/comfyui-vrgamedevgirl), restart, hard-refresh. Manual: git clone into custom_nodes, pip install -r requirements.txt; Windows portable needs Cython + scikit-build-core first.

Troubleshooting

A missing face in a group shot is a confidence problem - drop confidence toward 0.5 before you question the detector. A crop that's too tight to enhance means crop_padding_factor is too low; too loose and the enhancer wastes effort on hair and background. And the classic wiring error: if the paste-back lands in the wrong spot, the crop_data isn't being fed to the composite step - it's not a decoration, it's the coordinate system for putting the face back. Small faces in wide shots are the case the tiling exists for, so if you're enhancing a full-body scene, make sure you're not in a mode that skips them.

CategoryVRGameDevGirl/Image

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
model_rangeCOMBOfull_range2 options: full_range, short_range
confidenceFLOAT0.700.1–0.99
crop_padding_factorFLOAT0.400–2
minimum_face_pixelsINT244–2048
face_selectionCOMBO3 options: highest_confidence, largest, closest_to_center

Outputs (3)

NameTypeDescription
cropped_faceIMAGE
crop_dataCROP_DATA
detection_confidenceFLOAT