fatigue: Eye Aspect Ratio (EAR) drowsiness features from MediaPipe landmarks#1
Open
nikita-shar wants to merge 1 commit into
Open
fatigue: Eye Aspect Ratio (EAR) drowsiness features from MediaPipe landmarks#1nikita-shar wants to merge 1 commit into
nikita-shar wants to merge 1 commit into
Conversation
…ndmarks) Continuous EAR (Soukupova & Cech 2016) from raw MediaPipe Face Mesh landmarks, with PERCLOS / blink-rate / closure-duration / microsleep features. Local + on-device, no gateway or token. Implements the fatigue/RESULTS.md next-step. Standalone for now (3-line integration snippet in the module docstring). Tests in tests/test_ear.py (pure logic, no model/video). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
fatigue/ear.py— continuous Eye Aspect Ratio (Soukupová & Čech 2016) computed from raw MediaPipe Face Mesh landmarks, plus drowsiness features (PERCLOS, blink rate, closure durations, microsleep count). Local / on-device, no gateway or token. Implements the next-step fromfatigue/RESULTS.md("eye-aspect-ratio from raw MediaPipe landmarks would likely lift the 0.665").Why: the gateway only exposes a boolean
blink(eyeBlink > 0.5); EAR keeps the continuous signal + closure-duration info the boolean discards.Evidence (local, single-clip):
microsleep_count 0,perclos 0.02(correctly alert)microsleep_count 3, longest closure11.4s,perclos 0.44(correctly drowsy)Honest scope: prove-it-works on single clips, not an AUC comparison — confirming it lifts 0.665 needs labeled UTA-RLDD + LOSO (not run here; needs the dataset). Standalone (not wired into
train.py); a 3-line integration snippet is in the module docstring. Fixedclosed_thr=0.20; MediaPipe's EAR scale runs higher than classic dlib, so an adaptive per-person threshold is a sensible follow-up.Tests:
tests/test_ear.py(6, pure logic — no model/video).Deps:
fatigue/requirements-ear.txt(mediapipe + opencv, optional lane); model bundle auto-downloads tofatigue/models/(gitignored).🤖 Generated with Claude Code