Facial Coding System (Ekman & Friesen)

Detect micro-expressions → infer cognitive/emotional state → auto-trigger interventions

AU1+2 (Inner Brow Raise + Brow Raise)

Emotion:

Surprise or Confusion

Engagement:

↑ Unexpected challenge

Auto-intervention:

Offer hint or worked example

AU4 (Brow Lowerer)

Emotion:

Concentration / Effort

Engagement:

↑ Optimal (deep focus)

Auto-intervention:

Let child continue

AU7 (Lid Tightener)

Emotion:

Effort / Strain

Engagement:

⚠️ Possibly overloaded

Auto-intervention:

Monitor response time; if slow, reduce load

AU9 (Nose Wrinkler)

Emotion:

Disgust / Disdain

Engagement:

↓ Task not matching interest

Auto-intervention:

Suggest alternative modality

AU12+25 (Lip Corner Puller + Lips Part)

Emotion:

Joy / Genuine Enjoyment

Engagement:

↑↑ Flow state

Auto-intervention:

Maintain difficulty, log as "success moment"

AU15 (Lip Corner Depressor)

Emotion:

Sadness / Resignation

Engagement:

↓ Low motivation / defeat

Auto-intervention:

Pause, offer autonomy + encouragement

AU23 (Lip Tightener)

Emotion:

Tension / Anxiety

Engagement:

⚠️ Stress response

Auto-intervention:

Breathing prompt + reappraisal

AU26 (Jaw Drop)

Emotion:

Surprise / Shock

Engagement:

? Depends on context

Auto-intervention:

Check: Was this expected? Offer normalization

Session Timeline Example (10 min gaming)
0:00-1:00
AU4 (concentrate)

Focused attention ✓

1:00-2:30
AU1+2 (confused)

Unsure about task ⚠️ → Hint offered

2:30-5:00
AU4 (concentrate)

Refocused ✓

5:00-6:00
AU12+25 (joy)

Success moment 🎉

6:00-10:00
AU4 + AU7 (effort)

Sustained effort in challenge zone

Privacy-First Implementation

Storage:

Video NOT stored

Processing:

Real-time on-device (no cloud)

Data Retention:

Facial landmarks deleted after session (only AU codes + timestamps saved)

User Control:

Opt-in with clear consent, webcam light indicates active

Implementation Requirements

✓ Use ml5.js (TensorFlow.js based, runs on-device)

✓ Facial-landmarks-detection model (detects 468 landmarks on face)

✓ Compute AU activation from landmark positions

✓ Real-time inference (30fps) with zero server calls

✓ Clear opt-in consent + webcam permission request

base44
Edit with Base44