Deepface Analyze
Read age, gender, race and emotion off a whole batch of faces
- images
- analysis_results
You've rendered a hundred faces and you suspect your character is aging between seeds, or half the batch is drifting off the intended look. Deepface Analyze is the node that actually tells you, instead of making you eyeball a contact sheet. Drop a batch of images in and it runs the deepface library's Analyze on every one - predicting age, gender, race and emotion - then hands you a JSON result per image. No API, no key, no cloud; it all runs locally.
What it actually does
It's a thin wrapper around DeepFace.analyze() from serengil's deepface library, the same detection/recognition stack that sits behind a lot of face tooling. The node converts each ComfyUI image from RGB to OpenCV's BGR convention, detects the face, and runs whichever attribute models you ticked in actions. Two details are worth knowing:
enforce_detectionis hardcoded toFalsein this node, so an image with no detectable face doesn't kill the whole batch - it just comes back as an{"error": ...}entry in the results. Annoying if you wanted a hard failure, but better than a dead graph.analyzecan return more than one entry per image if several faces are detected, so don't assume the output lines up one-to-one with your inputs.
The inputs that matter
images- your batch. Everything else is preference.actions- a multiselect ofage,gender,race,emotion, all on by default. Deselect what you don't care about; each action is an extra model inference per image.detector_backend- defaultretinaface, which is accurate and slow-ish.opencvandssdare the lightweight options. Anything past those (dlib,mediapipe,yolov8,yunet,fastmtcnn) needs its own pip package installed before it'll run.
The output
analysis_results is a JSON list, one object per input image. ComfyUI's core nodes don't do much with bare JSON, so wire it into any text/JSON display node (a "show text" or debugger) or something that consumes JSON.
A word of skepticism
These predictions are directional, not forensic. Age gets famously fuzzy past ~30, and the race categories are the library's old-school, western-centric buckets - treat them as vibes with error bars, not census data. Where this node earns its keep is QC: catching age drift across a batch, spotting an emotion split in a render pass, or sanity-checking that the dataset behind a face LoRA actually contains what you think it does.
Installing it
It ships in jordoh/ComfyUI-Deepface, one small pack. Easiest path is ComfyUI Manager - search "ComfyUI Deepface" and install. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/jordoh/ComfyUI-Deepface
cd ComfyUI-Deepface
pip install -r requirements.txt
# then restart ComfyUI
That requirements file is the part to brace for: it's deepface==0.0.89 plus tf_keras, which drags in TensorFlow. TF is the whole reason this pack feels heavy - on Windows it wants CUDA, cuDNN and matching C++ tools, and if it can't see the GPU it quietly falls back to CPU. First run also downloads the models into ComfyUI/models/deepface (the pack points deepface's home directory there), so keep internet handy on the first execution.
Troubleshooting
- Everything slow? Check whether TensorFlow actually grabbed your GPU - the console log tells you. CPU fallback is the usual culprit.
ModuleNotFoundErrorfor a backend you picked?pip installthe matching package (dlib,mediapipe,fastmtcnn,ultralytics), not the pack.- This node isn't documented in the pack's README at all - only two of the four nodes are. If the schema surprises you, that's the author's oversight, not yours.
That's the whole pitch: if you're judging face batches by eye, this gives you a number to argue with instead.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| actions | COMBO | age,gender,race,emotion | 4 options: age, gender, race, emotion |
| detector_backend | COMBO | retinaface | 9 options: opencv, ssd, dlib, mtcnn, retinaface, mediapipe, +3 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| analysis_results | JSON | — |