Nodes/ComfyUI-off-suite/Query Gender and Age
ComfyUI Node

Query Gender and Age

It Tells You the Face's Age and Sex, So Your LoRA Can Too

By Off-Live·Created 3 years ago·Updated 2 years ago· 0
Query Gender and Age
  • model
  • image
  • STRING
  • NUMBER

This node reads a face and hands you back two facts: the detected sex and an estimated age. Boring on its own, genuinely useful once you realize it's a dataset-labeling tool that runs inside your graph instead of a separate script. If you're building a batch where age or gender has to influence the prompt - a LoRA that responds to "elderly man," a tagger that auto-annotates reference folders - you can pipe the result straight into a text-concat node and let the prompt rewrite itself per image.

It belongs to ComfyUI-off-suite, Off-Live's small grab-bag of face-crop and utility nodes. Like the rest of the pack, it's unremarkable on its own and handy in the right graph. There's no magic here, and that's the point.

How it works

The node takes an INSIGHTFACE model and an IMAGE, runs the face through InsightFace's face analysis, and returns faces[0].sex and faces[0].age. In practice that means:

  • model - must come from Impact Pack's Load InsightFace node (the INSIGHTFACE type is defined there, not by this pack). You'll need an InsightFace model file like buffalo_l, and those weights are non-commercial - fine for personal use, a problem if you ever want to sell the workflow that runs this.
  • image - one image in, and it only looks at the first face in the first image. Batch of five portraits? You get facts about face #1 only. Multiple faces in frame? Same - face #1 only.

Outputs are a STRING (the sex, returned as "M" or "F" by InsightFace) and a NUMBER (the age estimate). The age is an estimate and it reads as one - InsightFace's age model is ballpark, not oracle. Use it for relative ordering ("younger than that other image") rather than ground truth.

Why you'd actually wire this in

The killer use is conditional prompting without touching the graph between runs. Feed STRING into a text-concat with a template like a {sex}, age {age}, and every image in a batch gets a prompt that describes its own subject. People building age-sweep LoRA datasets find this path a lot easier than hand-writing 200 captions. It also makes a fine debug node for face pipelines - confirm the detector actually found a face before you send the crop downstream.

Install and gotchas

Same story as the whole pack:

cd ComfyUI/custom_nodes
git clone https://github.com/Off-Live/ComfyUI-off-suite
# or: ComfyUI Manager → search "ComfyUI-off-suite"

No extra Python dependencies - it leans on ComfyUI's bundled numpy, OpenCV and requests. The real prerequisite is Impact Pack (for the INSIGHTFACE loader) and an InsightFace model, both of which you're likely to have already if you've ever run FaceID or face-detail workflows.

The two traps to remember: only the first detected face is returned, and the sex string is uppercase "M"/"F", not "male"/"female" - match your prompt templates to that or you'll get literal sex: M in your output text. If model.get() ever returns an empty list (no face detected), the node throws, so put a simple image check upstream.

CategoryOFF

Inputs (2)

NameTypeDefaultDescription
modelINSIGHTFACE
imageIMAGE

Outputs (2)

NameTypeDescription
STRINGSTRING
NUMBERNUMBER