Nodes/comfyui-ageshift/πŸŽ‚ Age Detect
ComfyUI Node

πŸŽ‚ Age Detect

How Old Is This Face, Really? AgeDetect Runs the ViT and Tells You

By aadebugerΒ·Created 3 months agoΒ·Updated 3 months agoΒ· 0
πŸŽ‚ Age Detect
  • detector
  • image
  • age
  • age_band
  • confidence
  • summary
β—„methodweighted_meanβ–Ί

AgeDetect is the part of the AgeShift pack that looks at a face and tells you how old it thinks the person is. Feed it the detector bundle from AgeDetectorLoader plus an image, and it returns an integer age, a coarse band ("adult", "senior", that sort of thing), a confidence value, and a one-line human-readable summary. It's the "current age" measurement that the rest of your age-shift workflow builds on - you want to know you're starting from 40 before you ask Flux to draw 65.

It's a ViT image classifier under the hood, not a face-recognition engine, and that distinction is where most of the gotchas live.

How it works

The model classifies the image into nine age bins - 0-2, 3-9, ..., more than 70 - and outputs a probability per bin. Then a decode step turns bins into a number, and the method input picks how:

  • weighted_mean (default) - multiplies each bin's probability by that bin's midpoint and sums. So a face that's 47% "30-39" and 43% "40-49" lands somewhere in between rather than snapping to a bin center. This is why you get "32" and "47" instead of "34" and "44".
  • argmax_midpoint - just takes the single most-likely bin's midpoint. Cruder, and you get integer jumps, but it's more stable if you want the band verdict rather than a precise number.

confidence is the probability of the top bin, and summary is a formatted string that also lists the top-3 bins so you can see how torn the model was. When the top-3 spread looks wide, treat the integer age as a range, not a fact.

The inputs and outputs that matter

Inputs: detector (from the loader), image, and method. That's the whole list. For a first workflow, leave method on weighted_mean.

Outputs:

  • age (INT) - the estimate. This is the one that drives downstream logic.
  • age_band (STRING) - infant/child/teenager/young adult/adult/middle-aged/senior/elderly, bucketed from the integer.
  • confidence (FLOAT) - top-bin probability.
  • summary (STRING) - the readable verdict, handy to pipe into a PreviewAny or text display node for a quick check.

In the full pipeline, age is what you'd wire into a math node to compute target_age = age + 25, then feed that into AgePromptBuilder for a "age them up by a quarter century" workflow.

The catch: it classifies the whole image

Read the source docstring and it says it plainly: this is whole-image classification. Feed it a full group photo or a waist-up shot with a busy background and the estimate wanders. The fix is a face-crop upstream - the README points at Crystools or an InsightFace-based crop node - so AgeDetect sees a clean portrait. On the pack's own example workflows, the input is already a cropped face, and you should treat that as a requirement, not a suggestion.

A real-world honesty note

The default nateraw/vit-age-classifier has a documented habit of underestimating adults - people in the r/comfyui thread about ComfyUI age detection report 30+ faces reading as a few years younger, sometimes dramatically, and accuracy drops further on stylized or blurry inputs. The node can't fix the model's bias; it just reports it. So if the age feels low, the model probably isn't broken, and the summary's top-3 breakdown will usually show why (a split between adjacent adult bins reads as a younger weighted mean).

Install and troubleshooting

Same pack install as the loader - clone aadebuger/ComfyUI-AgeShift into custom_nodes, install the three-line requirements, restart. The detection side needs no PuLID or Flux; it runs in about two seconds even on CPU.

Realistic failure modes: an uncropped image (fix with a face-crop node), or a stale/corrupt model bundle (set force_reload on the loader once). Don't expect more precision than this class of model gives you - it's a ballpark number that's excellent for picking an age-shift target and useless for age-gating a product. It won't get that second job right, and no setting on this node will fix that.

CategoryπŸŽ‚ AgeShift

Inputs (3)

NameTypeDefaultDescription
detectorAGE_DETECTORβ€”
imageIMAGEβ€”
methodoptCOMBOweighted_mean2 options: weighted_mean, argmax_midpoint

Outputs (4)

NameTypeDescription
ageINTβ€”
age_bandSTRINGβ€”
confidenceFLOATβ€”
summarySTRINGβ€”