FaceRestoreCFWithModel
FaceRestoreCFWithModel – ComfyUI Node
- facerestore_model
- image
- IMAGE
What it is
This is the actual workhorse of the Facerestore CF pack. Feed it an image and a loaded restoration model, and it finds the face, runs it through the restoration network, and pastes the cleaned-up version back in place. It's the ComfyUI-native version of the "Restore faces" checkbox old AUTOMATIC1111 users will remember - except here it's a real node with real inputs instead of a hidden global toggle, which is a straight upgrade.
Worth being clear about what this isn't: it's not a face swap, and it's not a diffusion re-generation of the face. It's a dedicated GAN-based repair model (CodeFormer or GFPGAN) doing pixel-level cleanup on a face that's already there but looks rough - blurry, low-res, compression-artifacted, or just came out of a low-resolution processing step. That last case covers its most common real-world use: bolting this onto the end of a ReActor face-swap chain. Swap tools often work the face at a fairly small internal resolution, so the pasted-in result can look a touch soft; a restoration pass afterward is the standard fix.
Compare that to Impact Pack's FaceDetailer or A1111-family ADetailer, which take a completely different approach - detect the face, mask it, and re-generate it with your actual diffusion model and prompt. Those cost more compute and need your checkpoint loaded, but the result blends into the rest of the image's style. CodeFormer/GFPGAN restoration is fast and cheap by comparison, but it has a recognizable "look" of its own - smoothed, slightly plasticky at the extremes - that doesn't always match a stylized or painterly generation. Know which tool you actually want before reaching for either.
Inputs and outputs
Four required inputs, and all four matter:
- facerestore_model - the model coming out of FaceRestoreModelLoader. No shortcuts here, you need that node upstream.
- image - whatever you want fixed.
- facedetection - which face detector finds the face before restoration runs:
retinaface_resnet50,retinaface_mobile0.25,YOLOv5l, orYOLOv5n. retinaface_resnet50 is the sturdy default - most accurate, a bit heavier. The mobile/nano variants trade some accuracy for speed; reach for YOLOv5l or YOLOv5n if resnet50 is missing faces at odd angles or you're processing a batch and want it faster. - codeformer_fidelity - a float from 0 to 1 (default 0.5, step 0.05), and it's the one dial you'll actually touch. This balances quality against fidelity: push it down toward 0 and you get more of CodeFormer's own idea of a clean face - smoother, more corrected, but drifting further from what was actually in the source. Push it up toward 1 and it stays closer to the real input, artifacts and all, doing less aggressive repair. Heavily mangled faces (old scans, aggressive upscales) usually want it lower; faces that are only slightly rough want it higher so you're not overwriting real detail that didn't need fixing. 0.5 is a genuinely sane starting point.
One output: IMAGE - the restored image, same shape as what went in. Wire it straight into a preview, a SaveImage, or continue the pipeline (an upscaler downstream is common).
Installing it
Same pack, same steps as the loader node: install via ComfyUI Manager (search "Facerestore CF (Code Former)") or clone it manually -
cd ComfyUI/custom_nodes
git clone https://github.com/mav-rik/facerestore_cf.git
- then run the platform install script (
install.bat,embedded_install.bat, orinstall.sh; Python 3.12+ needsrequirements_312.txt). You'll also need at least one restoration model inmodels/facerestore_models(codeformer.pth or GFPGANv1.4.pth, downloaded manually) - see the FaceRestoreModelLoader article for exact links. The face detection models this node needs auto-download tomodels/facedetectionthe first time you run it, so that part's hands-off.
Common issues
Nothing happens / model errors out. Check FaceRestoreModelLoader actually has a model selected - an empty dropdown upstream means nothing to restore with.
Face isn't found at all. Try a different facedetection option. retinaface_resnet50 is the general-purpose pick, but it can whiff on extreme angles, partial occlusion, or unusually small faces in a wide shot; the YOLO variants sometimes catch what it misses, and vice versa.
Result looks waxy or over-smoothed. That's the model doing what it does, not a malfunction - CodeFormer and GFPGAN both have this signature at aggressive settings. Push codeformer_fidelity toward 1 to hold onto more real detail, or accept that this isn't the right tool if you need the fixed face to blend seamlessly into a stylized render - that's a job for a diffusion-based detailer instead.
Double-restored, weirdly over-processed faces after a ReActor chain. ReActor has its own built-in restoration step (it can run CodeFormer internally as part of the swap). If you're also running this node right after it, you may be stacking two restoration passes on the same face. Check ReActor's own restore settings before assuming this node is the problem.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| facerestore_model | FACERESTORE_MODEL | — | |
| image | IMAGE | — | |
| facedetection | COMBO | 4 options: retinaface_resnet50, retinaface_mobile0.25, YOLOv5l, YOLOv5n | |
| codeformer_fidelity | FLOAT | 0.500–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |