image-classification Β· basics 3 framings Β· 1 photo WASM q8 Β· 87.34 MB License: Apache-2.0

Inside FairFace ViT: Crop Tightness & Framing Sensitivity Lab

The ViT never sees "a person" β€” it sees a 224Γ—224 square of pixels. Run the same photo three ways (full scene, head-and-shoulders, tight face) and measure empirically how much the apparent-age distribution moves when background and shoulders are cropped in or out.

Framing lab

Why this matters.

If a crop alone can shift the top bracket, a single label is not a fact about the person. This is apparent age under the FairFace taxonomy β€” never use it for age-gating or decisions about people.

Tap the face to re-anchor the medium and tight crops.

Initialising model loader…

Framing sensitivity

Expected-age spread–
Top-1 agrees?–
Max JS divergence–
Total latency–
Pairwise distribution shift between framings
Pair Top-1 Ξ” expected age Ξ” entropy Total variation JS divergence
Run all 3 framings to compare.

Inside: what the ViT actually sees

ViTFeatureExtractor resizes every input straight to 224Γ—224 (no aspect-ratio preservation), rescales by 1/255 and normalises with mean 0.5 / std 0.5, then splits it into 14Γ—14 = 196 patches of 16Γ—16 px. A full-scene photo squeezes the face into a handful of patches and stretches it; a tight crop gives the face almost every patch. The thumbnails above are drawn at the model's own 224Γ—224 resolution so you see the same squash the processor applies.

Medium crop = a square 2.6Γ— the face height, nudged down to include shoulders; tight crop = 1.15Γ— the face height. Both are clamped (shifted, never squashed) inside the photo.

Show the code β€” age-core.mjs: computeFramingCrops() (full / medium / tight squares)
Show the code β€” age-core.mjs: distributionShift() (Ξ” age, Ξ” entropy, TV, JS)
Show the code β€” age-core.mjs: framingSensitivity() (spread + top-1 agreement)

References