Cue Mirror expression model
How ProSocial trained a 4.25 MiB, temperature-calibrated, 100% on-device browser model to recognize eight facial expressions at 10 frames per second on everyday laptops.
What shipped
Cue Mirror gives ProSocial members a private live mirror for practicing camera presence and facial expression awareness. On December 1, 2026, ProSocial upgraded Cue Mirror to a custom-distilled, temperature-calibrated 224 px EfficientNet-B0 model (prosocial_efficientnet_b0_distill.int8w.onnx, T = 0.4) engineered for fast, private browser execution.
- 4.25 MiB model footprint: 2.4× smaller than the retired 10.3 MB MobileViT model, paired with a 230 KB OpenCV YuNet face detector.
- 31.7 ms median per frame in plain Chrome WebAssembly: 4.2× faster than the retired 132.1 ms WASM runtime, and single-digit milliseconds on WebGPU.
- Full 100 ms (10 fps) cadence on slower laptops: Reaches 81.0% microexpression+label recall (68/84), 75.0% contempt micro recall (9/12), and 83.3% strict held-expression recall (35/42) with 0.0% neutral false positives across WebGPU, plain WASM, and 2× slow-laptop profiles—where MobileViT fell behind to 146–280 ms and dropped to 0.0% on slow laptops.
- Beats the 3-teacher ensemble on held-out faces: Achieves 0.691 mean macro-F1 and 71.8% end-to-end accuracy across strictly held-out
RAF-DB test,ExpW, andCK+benchmarks (surpassing the 3-teacher flip-TTA ensemble’s 0.647 macro-F1). - 100% local execution: Face detection and expression classification run inside a sandboxed browser Web Worker via ONNX Runtime Web. No webcam frames, face crops, or expression scores ever leave the user’s device.
- Eight direct expressions including contempt: Classifies anger, contempt, disgust, fear, happiness, neutral, sadness, and surprise directly without blendshape heuristics, calibrated to each person’s ~1.5-second resting face.
Why speed matters for microexpressions
Microexpressions last half a second (500 ms) or less. To separate a genuine fleeting cue from a single frame of motion blur, Cue Mirror’s event detector requires at least two consecutive model reads inside that window. That sets a hard sampling ceiling of 250 ms per frame, with production targeting 100 ms (10 frames per second).
On modern laptops with WebGPU enabled, large neural networks run comfortably below 100 ms. On older laptops, locked-down enterprise browsers, or machines falling back to single-thread CPU WebAssembly (WASM), a 132 ms model plus face detection and browser overhead slows to 146–280 ms per frame. At 280 ms per sample, a 220 ms microexpression can begin and end entirely between two snapshots.
Hardware honesty is built into the runtime: Cue Mirror tracks its live frame cadence in the browser. If a device still runs slower than 250 ms per frame, the interface tells the member directly and records every event as a held expression rather than treating sampling luck as a microexpression measurement.
Multi-teacher distillation & calibration
To cut model size by 2.4× and CPU latency by 4.2× while surpassing off-the-shelf accuracy, ProSocial trained a compact 224 px EfficientNet-B0 student model using multi-teacher knowledge distillation and post-training temperature calibration:
- Preserved 8-class warm start: Remapped the pinned EmotiEffLib
classifier.0head weights cleanly into the student before distillation so all eight pretrained expression outputs started aligned. - Three specialist teacher models: Three EmotiEffLib teachers (
MobileViT VA-MTL,EfficientNet-B2, andEfficientNet-B0 VGAF) ran with horizontal flip test-time augmentation to generate soft probability targets across all eight expression classes. - 73,271 real faces in training (77,471 including internal validation): Doubled the unlabeled demographically balanced FairFace pool to 62,000 training crops (+ 3,200 internal validation crops) combined with 11,271 natural RAF-DB training crops (+ 1,000 internal validation crops), trained with EMA weights, class-balanced minibatches, and standardized logit distillation.
- Strict benchmark isolation: Every public evaluation benchmark (
RAF-DB test,ExpW, andCK+) stayed strictly held out from training and checkpoint selection. - Lossless weight-only int8 quantization + temperature calibration (
T = 0.4): Weight-onlyint8quantization kept the shipped file at 4.25 MiB, and a +93-byte output temperature scaling layer (T = 0.4) sharpened brief sub-second peaks so genuine flashes cleanly cross Cue Mirror’s resting-face threshold without triggering false alarms on neutral controls.
Held-out static accuracy benchmarks
Every model generation was evaluated end to end through the same webcam-like preprocessing and face-detection pipeline across three strictly held-out public benchmarks: RAF-DB test (3,068 in-the-wild faces), ExpW subset (2,832 in-the-wild faces), and CK+ (981 posed frames including contempt). Missed face detections count as errors in end-to-end accuracy.
| Model generation | Size | Plain WASM latency | Mean macro-F1 | End-to-end accuracy | RAF-DB / ExpW / CK+ F1 |
|---|---|---|---|---|---|
| Custom ProSocial EfficientNet-B0 (224 px, T = 0.4, int8) | 4.25 MiB | 31.7 ms (4.2× faster) | 0.691 | 71.8% | 0.785 / 0.441 / 0.846 |
| 3-teacher flip-TTA ensemble (offline ceiling) | — | — | 0.647 | 68.4% | 0.613 / 0.449 / 0.877 |
| Previous MobileViT VA-MTL (int8) | 10.3 MB | 132.1 ms | 0.632 | 66.2% | 0.589 / 0.435 / 0.873 |
Interim face-api.js (unmaintained) |
0.3 MB + TF.js | — | 0.455 | 56.2% | 0.461 / 0.324 / 0.581 |
| Original MediaPipe blendshape rules | 3.8 MB + WASM | — | 0.149 | 21.4% | 0.098 / 0.104 / 0.246 |
On static posed CK+ images scored with no per-person resting baseline, single-frame contempt recall is 66.7% (compared with 87.0% on MobileViT). Under Cue Mirror’s real baseline-subtracted temporal pipeline below, contempt microexpression recall jumped in the opposite direction—to 75.0% (9/12), triple MobileViT’s 25.0%.
Real-world temporal video benchmark
Static photos measure single-frame recognition, not whether a live mirror catches brief facial movements under real laptop frame rates. To test end-to-end temporal behavior, ProSocial ran each model through the exact production TypeScript pipeline (resting-face calibrator, classifier, score smoother, and event detector) across 140 real-face video episodes (37,800 frames) containing 220 ms and 360 ms microexpressions, 900 ms held expressions, and neutral-only controls, clamped to production’s 100 ms sampling floor.
| Model | Hardware tier (frame time → cadence) | Micro + label | Contempt micro | Held + label (strict) | Neutral FPR |
|---|---|---|---|---|---|
| Custom ProSocial EfficientNet-B0 (224 px, T = 0.4) | WebGPU (~18 ms), Plain WASM (~46 ms), or 2× slow-laptop WASM (~91 ms) → 100 ms cap | 81.0% (68/84) | 75.0% (9/12) | 83.3% (35/42) | 0.0% (0/14) |
| Previous MobileViT VA-MTL | WebGPU (~22 ms → 100 ms cap) | 34.5% | 25.0% | 54.8% | 0.0% |
| Previous MobileViT VA-MTL | Plain WASM (146 ms) | 28.6% | 25.0% | 54.8% | 0.0% |
| Previous MobileViT VA-MTL | 2× slow-laptop WASM (280 ms) | 0.0% | 0.0% | 57.1% | 0.0% |
This benchmark replays the 140 precomputed frame-probability sequences deterministically using measured single-thread Chrome WASM latency (YuNet ~14 ms plus expression inference) alongside modeled WebGPU and 2× slow-laptop timing profiles. Because Cue Mirror caps sampling at 100 ms (10 fps), every hardware tier that finishes under 100 ms hits the exact same sampling timestamps—which is why all three tiers for the custom model collapse to one identical row (81.0% microexpression+label recall, 75.0% contempt micro recall, 83.3% strict held recall, 0.0% neutral false positives), whereas MobileViT overflows the 100 ms cap on CPU and crosses the 250 ms cutoff on slower laptops.
On-device privacy and resting-face calibration
Sandboxed browser execution
Both OpenCV YuNet (230 KB) and prosocial_efficientnet_b0_distill.int8w.onnx (4.25 MiB) execute inside a dedicated browser Web Worker protected by a narrow Content Security Policy that restricts fetches to same-origin model assets and the pinned ONNX Runtime Web WASM runtime. Only the detected face count and eight probabilities pass back to the page UI. No webcam frames, face crops, or live expression scores ever leave your device.
Calibrated to your resting baseline
Natural facial geometry varies widely from person to person. At the start of each session, Cue Mirror observes your resting face for approximately 1.5 seconds and records a personal floor for all eight classes. Live scores measure movement above that resting baseline by subtraction (never rescaling), so a naturally intense brow or downturned mouth corner stays quiet until your expression genuinely shifts.
Scope, tradeoffs, and attribution
- Self-awareness mirror, not mind-reading: No facial expression model achieves 100% accuracy in real-world lighting, and an expression alone never proves internal intent. Cue Mirror flags possible microexpressions and held expressions strictly as private self-practice feedback.
- Benchmark vs. live-webcam validation: The 140-episode benchmark uses 14 brightness-jittered still neutral controls; live-camera rollout checks under real blinking, speech, head motion, and changing lighting remain part of our release validation (and output temperature can be tuned without retraining if live lighting proves overly sensitive).
- Static vs. baseline-calibrated contempt tradeoff: Static single-frame CK+ contempt recall without resting-face calibration is 66.7% (vs. 87.0% on MobileViT), while baseline-subtracted temporal contempt microexpression recall tripled from 25.0% to 75.0% (9/12).
- Single-face self-analysis: When zero or multiple faces enter the frame, Cue Mirror pauses feedback automatically.
- Dataset attribution: Training distillation incorporates unlabeled crops from FairFace (Kimmo Kärkkäinen & Jungseock Joo, FairFace: Face Attribute Dataset for Balanced Race, Gender, and Age for Bias Measurement and Mitigation, WACV 2021, licensed under CC BY 4.0), alongside RAF-DB training crops and Apache-2.0 EmotiEffLib base models.