face-detection → image-classification 2 models · 2 Web Workers 0.23 MB + 87.34 MB WASM MIT + Apache-2.0

2-Stage Multi-Face Detect → Crop → FairFace Age Estimator

Stage 1, OpenCV YuNet (opencv/face_detection_yunet, 0.23 MB, MIT), finds every face in a group photo. Each face is cropped to a square with a margin and handed to Stage 2, the FairFace ViT (onnx-community/fairface_age_image_detection-ONNX, 87.34 MB q8, Apache-2.0), which returns that face's full 9-bracket apparent-age distribution — compared side by side with what the model says when it sees the whole frame at once.

1 · Workflow models

Stage 1 · OpenCV YuNet face detector (0.23 MB)

Reuses ../yunet-face-detection/worker.js — raw onnxruntime-web WASM, 5 landmarks + NMS.

Stage 2 · FairFace Age Classifier ViT (87.34 MB)

Uses ./worker.js — shared Transformers.js image-classification, q8 WASM.

2 · Detect, crop, estimate

Group photos amplify mistakes.

Per-face apparent-age guesses are noisy and taxonomy-bound. Never use them to age-gate, identify, or sort real people. Everything runs on this device.

Initialising the two-stage workflow…

No photo analysed yet.

Faces found–
Stage 1 (YuNet)–
Stage 2 (ViT) total–
Full-frame top-1–
Full-frame entropy–
High-uncertainty faces–

Full frame vs each face crop

See inside the code

Show the code — age-core.mjs: expandFaceBox() (YuNet box → square crop with margin)
Show the code — worker.js: classifyImage() (Stage 2 per-face ViT inference)
Show the code — age-core.mjs: distributionShift() (face crop vs full frame)

References