Nodes/ComfyUI-KEEP/Load KEEP Models
ComfyUI Node

Load KEEP Models

The boring node that decides whether KEEP is worth the download

By wildminder·Created about a year ago·Updated 5 days ago· 70
Load KEEP Models
  • bg_upscale_model
  • face_upscale_model
  • keep_model_pack
◄modelKEEP►
◄detection_modelretinaface_resnet50►

KEEP is a face restorer out of a video research project - Kalman-Inspired Feature Propagation, ECCV 2024 - built to keep a face looking like the same face across hundreds of frames instead of re-inventing it per frame. "Load KEEP Models" is the node you wire first and think about least, and it's where the pack's actual opinions live: which face detector runs, and which upscalers get bolted onto the result.

What it actually loads

Three things, and it's worth naming them because they explain most of the behaviour you'll see downstream.

The KEEP network itself - a VQGAN-based restorer with a temporal module - gets pulled as KEEP-b76feb75.pth into ComfyUI/models/keep_models/KEEP/. Then a face-detection and face-parsing stack lands in ComfyUI/models/facedetection/: a RetinaFace backbone, a YOLOv5 face detector, and parsing_parsenet.pth, which is the segmentation model that decides which pixels are face when the restored patch gets blended back into the original. Then, optionally, whatever UPSCALE_MODEL you plug into the two optional inputs.

All of that is wrapped in one object with one output, keep_model_pack. That isn't a model handle in the usual ComfyUI sense - it carries the network, the face helper, and both upscalers as a bundle, and the processing nodes move the whole thing to your GPU for a run and back to CPU when they're done. ComfyUI normally keeps models resident; here, every invocation pays a transfer.

The inputs that matter

model is a two-item dropdown: KEEP or Asian. There are two separate checkpoints, not a quality slider. Default KEEP unless your source is specifically East Asian faces - the Asian checkpoint is a separately trained variant and applying it to everything is not an upgrade.

detection_model gives you four choices: retinaface_resnet50 (the default), retinaface_mobile0.25, YOLOv5l, YOLOv5n. This is the one genuinely useful knob on the node. The ResNet50 RetinaFace is the most reliable detector of the four and the slowest; retinaface_mobile0.25 and YOLOv5n are the fast ones you reach for when you're running a 400-frame sequence and detection is your bottleneck rather than the network. If you're seeing missed faces in crowds or profiles, move up to YOLOv5l, not down.

bg_upscale_model and face_upscale_model both accept a standard UPSCALE_MODEL - the thing that comes out of core's Upscale Model Loader. bg_upscale_model handles everything that isn't a face; face_upscale_model gets applied to the restored face crop, on top of what KEEP already did. Both are optional, and leaving them empty is a legitimate setup: you get a Lanczos-resized background and a KEEP-restored face, which is the cheap configuration for a batch job where you don't want a 4x ESRGAN pass on every frame.

Before you connect a 4x model: the upscaler's own scale runs first, then the result is resized to whatever final_upscale_factor the processing node asks for. A 4x model at factor 2.0 means 4x worth of detail squeezed to 2x - usually what you want, but you pay the 4x cost in VRAM and time.

Install

Through ComfyUI Manager, search the pack title ComfyUI-KEEP and install. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/wildminder/ComfyUI-KEEP
cd ComfyUI-KEEP
pip install -r requirements.txt

Then restart ComfyUI. The weights download themselves on first use - and here's the part nobody mentions: the loader pulls all five face-stack files regardless of which detection_model you picked, because it iterates the whole URL table. The first run sits there downloading a few hundred MB you may never load. It's a one-time cost; don't assume it's hung.

If a download dies, the README points at the original KEEP v1.0.0 release - grab the .pth files by name and drop them into the two folders above. Filenames have to match exactly; the loader checks for existence, not for correct contents.

Where people get burned

requirements.txt lists bare torch and torchvision. Run it inside an environment with a specific CUDA build and pip is happy to helpfully replace it with a default-CUDA wheel, and now ComfyUI is complaining about mismatched binaries. Install the rest and skip those two, since ComfyUI already brought its own:

cd ComfyUI/custom_nodes/ComfyUI-KEEP
grep -v -E '^(torch|torchvision)$' requirements.txt > /tmp/keep-req.txt
pip install -r /tmp/keep-req.txt

Failed loads turn into None. If the weights don't load, the processing nodes log Invalid KEEP Model Pack and hand back None, which surfaces downstream as a confusing type error on Save Image. Read the console, not the graph.

Wire this node once, and reuse its single output across as many processing nodes as you like - that's the intended pattern, since the bundle is cached and shared.

CategoryComfyUI-KEEP

Inputs (4)

NameTypeDefaultDescription
modelCOMBOKEEP2 options: KEEP, Asian
detection_modelCOMBOretinaface_resnet504 options: retinaface_resnet50, retinaface_mobile0.25, YOLOv5l, YOLOv5n
bg_upscale_modeloptUPSCALE_MODEL—
face_upscale_modeloptUPSCALE_MODEL—

Outputs (1)

NameTypeDescription
keep_model_packKEEP_MODEL_PACK—