ComfyUI Node Runs on cloud

CropFace

CropFace – ComfyUI Node

By mav-rik·Created 3 years ago·Updated about a year ago· 339
CropFace
  • image
  • IMAGE
facedetection

What it is

CropFace is the quiet utility node tucked into the Facerestore CF pack, sitting next to the two nodes that actually get most of the attention (FaceRestoreModelLoader and FaceRestoreCFWithModel). It doesn't restore anything. All it does is run face detection on an image and hand you back a cropped, aligned image of the face it found. No CodeFormer, no GFPGAN, no model loading required at all.

That narrow job is still genuinely useful. FaceRestoreCFWithModel does its own detection internally as part of restoring a face, which means you never actually see what it detected unless something goes wrong. CropFace lets you check that step in isolation - wire your image through it with the same facedetection backbone you're planning to use for the real restore pass, and look at what comes out. If the crop is empty, off-center, or clearly not a face, you've found your problem before wasting a restoration pass on it. It's also handy any time you want an isolated, aligned face crop for its own sake - feeding into a face-comparison tool, building a reference set, or just inspecting a batch of generations for which ones actually have a usable face in them.

Inputs and outputs

Just two inputs:

  • image - the image to detect a face in.
  • facedetection - the detection backbone to use: retinaface_resnet50, retinaface_mobile0.25, YOLOv5l, or YOLOv5n. Same four options, same trade-offs as the restore node - retinaface_resnet50 is the accurate default, the YOLO and mobile variants are faster but can miss faces at awkward angles or small scale.

One output: IMAGE - the cropped, aligned face. Nothing else changes about it; there's no restoration or enhancement happening here.

Installing it

It's the same pack as the other two Facerestore CF nodes, so there's nothing separate to do. Install via ComfyUI Manager (search "Facerestore CF (Code Former)") or:

cd ComfyUI/custom_nodes
git clone https://github.com/mav-rik/facerestore_cf.git

then run the platform install script - install.bat on Windows, embedded_install.bat for the portable build, install.sh on Linux/Mac (Python 3.12+ needs requirements_312.txt). CropFace only needs the face detection models, which auto-download to models/facedetection on first use - you don't need to manually fetch the restoration weights (codeformer.pth / GFPGANv1.4.pth) unless you're also using FaceRestoreCFWithModel elsewhere in the same workflow.

Common issues

Output looks like the full image, or detection clearly failed. No face was found with the current backbone. Swap facedetection - YOLOv5n is fast but the most prone to missing smaller or rotated faces; retinaface_resnet50 is the one to fall back to if a faster option isn't finding anything.

Expecting a quality improvement and not seeing one. This node doesn't touch image quality at all - it only detects and crops. If what you actually want is a fixed face, this isn't it; pair it with FaceRestoreCFWithModel (or reach for that node directly, since it detects internally anyway) if repair is the goal.

Not sure why you'd use this over just running the restore node directly. For most workflows, you wouldn't - FaceRestoreCFWithModel already does its own detection, so CropFace is genuinely optional for a straightforward restore. It earns its keep when you want the crop as a standalone artifact, or when you're debugging why a restoration pass isn't finding a face and want to isolate the detection step from the restoration step to see which one's actually failing.

Categoryfacerestore_cf

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
facedetectionCOMBO4 options: retinaface_resnet50, retinaface_mobile0.25, YOLOv5l, YOLOv5n

Outputs (1)

NameTypeDescription
IMAGEIMAGE