Nodes/h4_Live/h4 - Build Face Model
ComfyUI Node

h4 - Build Face Model

Turn a folder of photos into a reusable face model in one pass

By m3rr·Created 9 months ago·Updated 10 days ago· 1
h4 - Build Face Model
  • images
  • FACE_MODEL
compute_methodMean
folder_path
det_size640x640

H4_BuildFaceModel is the "make a reusable face" step in h4_Live's FaceForge suite. Feed it a batch of photos of the same person and it hands you back a FACE_MODEL - a saved identity you can plug into H4_FaceForge, H4_IdentityEngine, or H4_FaceDetailer later without re-supplying the reference photos every time. If you're building a consistent character across a whole story or series of generations, this is the node that does the boring, important job of turning "these five images" into "this one reusable thing."

Under the hood it's InsightFace doing the work: detect every face in each image, align it, and turn it into an ArcFace embedding - a vector encoding facial geometry rather than appearance. That's the same recognition backbone behind IP-Adapter FaceID, InstantID, ReActor, and friends, so you're standing on well-trodden ground, not an h4 invention. The node then combines the embeddings from all your images into a single model.

The few settings that matter

  • compute_method - how to combine the faces. Mean is the author's recommendation and usually right: it averages the embeddings into a solid central identity. Median shrugs off weird outliers (a bad photo with an off expression), and Mode is rarely the answer.
  • images or folder_path - you use one or the other. Wire a batch of images in (say from a Load Image Batch), or paste a full folder path like C:\MyPhotos and let it scan. Folder mode is great when you have a reference folder sitting on disk already.
  • det_size - the scan resolution. 640x640 finds small faces better; 320x320 is faster but misses distant faces. The code even retries at a smaller size if the first pass finds nothing, so don't overthink it.

The output

One output, FACE_MODEL, which is the pack's own type for a serialized face identity. It's the direct input to the other FaceForge nodes - that's the entire point of building one. Save it with the companion save/load nodes in the suite if you want it to survive a restart.

Installing and dependencies

ComfyUI Manager → search "h4_Live", or:

cd ComfyUI/custom_nodes
git clone https://github.com/m3rr/h4_Live

then restart. Here's the real gotcha: this node (and the whole FaceForge suite) needs insightface, onnxruntime, and opencv in your Python environment. h4_Live ships no requirements.txt, and these are lazy-imported, so the pack installs fine and the node only blows up the first time you actually run it with a ModuleNotFoundError. If that happens:

pip install insightface onnxruntime opencv-python

Face models (the analyzer weights) auto-download into your models/ folders on first use, which is handy but means the first run stalls while it pulls them.

Where people get burned

Quality in, quality out: the combined model is only as good as your reference batch. Use several well-lit, front-facing shots; one blurry selfie averaged with three good photos drags the Mean down. And don't expect a FACE_MODEL to do what a LoRA does - this is a face-swap identity, not a character model that captures body, clothing, and style. Keep your scenes in the prompt, not in the face model.

Categoryh4_Live/FaceForge

Inputs (4)

NameTypeDefaultDescription
compute_methodCOMBOMeanHow to combine the faces? 'Mean' is usually best. 'Median' ignores weird outliers.
imagesoptIMAGEConnect a Batch of images here (e.g. from Load Image Batch).
folder_pathoptSTRINGOr paste a full folder path here (e.g. C:\MyPhotos).
det_sizeoptCOMBO640x640Scan resolution. 640x640 finds small faces better.

Outputs (1)

NameTypeDescription
FACE_MODELFACE_MODEL