CogniFlow: A Multi-Modal, Hardware-Free Real-Time Cognitive Focus Monitoring System Using Webcam, Keyboard, Mouse and Window Context Fusion
Abstract
Cognitive fatigue is a pervasive yet largely invisible challenge in modern knowledge work and education. Mental performance degrades gradually during prolonged screen-based tasks, yet no affordable, passive, physiologically grounded tool exists to detect and communicate this degradation in real time. This paper reports the design, implementation, and validation of CogniFlow, a fully operational desktop application that computes a personalised cognitive focus score (0–100) every two seconds by fusing five independent behavioural and physiological signals: (1) Eye Aspect Ratio (EAR) derived from MediaPipe FaceMesh landmarks to detect eye closure and drowsiness, (2) Mouth Aspect Ratio (MAR) to detect yawning events, (3) keyboard flight-time variance as a proxy for cognitive engagement quality, (4) mouse movement activity, and (5) foreground window context for application-level behavioural signal. A 30-second personal calibration phase derives user-specific EAR and MAR thresholds using the mean open-eye baseline and 90th percentile mouth-at-rest value, eliminating the need for population-level defaults or labelled training data. The completed system employs a four-state yawn state machine (IDLE → OPENING → CONFIRMED → DEBOUNCE) with temporal filtering to suppress false positives. A weighted fusion model combines five signal scores — eyes 35%, typing variance 25%, state context 20%, yawn count 15%, mouse activity 5% — smoothed over an eight-reading rolling window. CogniFlow operates entirely on-device using a standard laptop webcam at 30 fps with less than 15% CPU utilisation, requires zero additional hardware, and stores no video, keystroke content, or biometric templates. CogniFlow has been fully implemented, tested across multiple users, and validated against published EAR and MAR physiological ranges.
Fields of Study & Subjects
Sleep and Work-Related Fatigue
Human-Automation Interaction and Safety
Emotion and Mood Recognition
Publication details
- Journal / source
- Zenodo (CERN European Organization for Nuclear Research)
- Publication date
- 12 March 2026
- Language
- EN
- Document type
- Preprint