image-classification · vision 9 FairFace age brackets WASM q8 · 87.34 MB License: Apache-2.0

FairFace Age Classifier (ViT) — 9-Bracket Age Distribution & Uncertainty Lab

A ViT-Base/16 fine-tuned on the race-balanced FairFace dataset estimates apparent age as a probability over nine brackets. This lab never collapses that into a single "age": it shows the whole ordered distribution, its expected midpoint, an 80% interval, and the Shannon entropy — all computed 100% on your device in a Web Worker.

At a glance

Upstream model dima806/fairface_age_image_detection
Loaded ONNX repo onnx-community/fairface_age_image_detection-ONNX (onnx/model_quantized.onnx)
Pipeline task image-classification · { top_k: null } (all 9 scores)
Architecture ViTForImageClassification — ViT-Base/16, 12 layers, 768-d, 224×224 input, ViTFeatureExtractor (rescale 1/255, normalise mean 0.5 / std 0.5)
Labels (live id2label) 0-2 · 3-9 · 10-19 · 20-29 · 30-39 · 40-49 · 50-59 · 60-69 · more than 70
Backend & size CPU WASM q8 — 87.34 MB (87,339,068 B) via the shared @huggingface/transformers@3.7.5 pin in lib/webai.js. No GPU required.
License Apache-2.0 (model card); FairFace dataset CC BY 4.0
Responsible use — apparent age is not real age.

Predictions are noisy, swing with lighting, crop, pose, make-up and image quality, and only reflect how the FairFace annotators' bracket taxonomy maps onto a face. Never use this for age-gating, identity verification, eligibility, or any automated decision about a person. Photos never leave your device.

Interactive 9-bracket distribution & uncertainty

Pick a rights-cleared portrait, or upload / drop / paste your own photo (or take one with your camera). The model scores all nine brackets; we derive the expected midpoint, the 10th–90th percentile interval, and the entropy that tells you how unsure it is.

Initialising model loader…

No photo selected yet.

Expected midpoint–
80% interval–
Shannon entropy–
Uncertainty–
Top-1 margin–
Latency–
Backend / dtypewasm · q8
NaN / invalid0

Top-3 brackets

  1. Run the model to see the top-3 brackets.

Bars are ordered youngest → oldest. "more than 70" is open-ended; for midpoint maths we assume [70, 85) — a documented modelling choice, not a model output.

Raw pipeline output (exact label/score pairs)
[]

See inside the code

The exact ES modules running on this page — the off-main-thread worker and the pure uncertainty maths.

Show the code — worker.js: ensureLoaded() (shared 3.7.5 WASM q8 + epoch guards)
Show the code — worker.js: classifyImage() (0×0 guard, white-flatten, top_k: null)
Show the code — age-core.mjs: orderDistribution() (dynamic 9-bracket ordering)
Show the code — age-core.mjs: computeAgeStats() (midpoint, interval, entropy)

Explore the 5-route use-case ladder

References & model card