Real-time Fatigue and Attention Analysis using Computer Vision
A desktop application that analyzes user fatigue and attention level in real time using webcam video and facial landmark detection.
AffectFlow is a desktop application designed to monitor fatigue and attention levels using computer vision techniques.
The system analyzes facial features in real time and evaluates:
- Eye blinking patterns (EAR)
- Yawning detection (MAR)
- Gaze direction
- Head position
All processing is performed locally — no cloud services required.
- Webcam capture
- User interface
- Charts visualization
- Communication with backend
- MediaPipe FaceMesh landmark detection
- EAR calculation (Eye Aspect Ratio)
- MAR calculation (Mouth Aspect Ratio)
- Fatigue scoring algorithm
- Attention estimation
Data flow:
Camera → Electron (JS) → Python analysis → Metrics → UI update
- Electron
- HTML / CSS
- JavaScript
- Chart.js
- Python
- MediaPipe
- OpenCV
- Real-time fatigue monitoring
- Attention level estimation
- Local processing (privacy friendly)
- Blink detection algorithm
- Yawn detection
- Automatic break recommendation
- Interactive statistics visualization
- Multi-page desktop interface
Make sure you have installed:
- Node.js (LTS version recommended)
- Python 3.10+ (recommended)
- Clone the repository:
git clone https://github.com/b-bohdan-st/affectflow.git
cd affectflow- Install Node.js dependencies:
npm install- Install Python dependencies:
pip install mediapipe==0.10.21 opencv-python numpy pygame pyqt6- Start the application:
npm start- Launch the application
- Press Start analysis
- Real-time monitoring begins
- View statistics in the Statistics tab
- User profiles
- Custom AI model training
- Model sharing between users
- Extended analytics system
- Mobile companion
- Education and learning focus monitoring
- Workplace productivity
- Digital wellbeing
- Ergonomic analysis
Bohdan Bondar
Educational project.

