Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Driver Cognitive State Analysis

A real-time driver monitoring system that detects fatigue and cognitive distraction using facial landmark analysis, temporal feature engineering, and ensemble machine learning.

Overview

Driver fatigue and distraction are among the leading causes of road accidents worldwide. Existing monitoring systems often rely on isolated indicators such as eye closure or steering patterns, limiting their ability to accurately capture a driver's cognitive state.

This project presents a vision-based driver monitoring framework that combines computer vision, behavioral feature extraction, machine learning, and deep learning techniques to classify driver states in real time.

The system analyzes facial behavior including eye movements, blinking patterns, yawning activity, and head pose dynamics to identify signs of fatigue and reduced attentiveness.


Problem Statement

Develop a non-intrusive driver monitoring system capable of detecting fatigue and cognitive distraction from video streams without requiring physiological sensors such as EEG or ECG.

The system should:

  • Operate in real time
  • Extract meaningful behavioral features from facial landmarks
  • Learn temporal fatigue patterns
  • Provide reliable driver state classification

Architecture

System Architecture

Methodology

1. Facial Landmark Detection

Facial landmarks are extracted using MediaPipe to track key facial regions including:

  • Eyes
  • Mouth
  • Nose
  • Jawline

2. Behavioral Feature Engineering

The following fatigue-related indicators are computed:

Feature Description
EAR Eye Aspect Ratio
Blink Rate Number of blinks over time
Eye Closure Duration Consecutive closed-eye frames
MAR Mouth Aspect Ratio
Yawning Frequency Yawning behavior over time
Head Pose Driver head orientation
Eye Asymmetry Fatigue-related eye behavior

3. Temporal Feature Extraction

Frame-level observations are aggregated into temporal windows to capture fatigue progression and behavioral trends.

4. Model Training

The engineered features are used to train multiple classifiers:

  • Random Forest
  • XGBoost
  • CNN-LSTM

5. Ensemble Decision System

Predictions from individual models are combined using an ensemble framework to improve robustness and reduce false detections.


System Pipeline

Video Stream
      │
      ▼
Face Detection
      │
      ▼
MediaPipe Landmark Extraction
      │
      ▼
Feature Engineering
(EAR, MAR, Blink Dynamics,
Head Pose, Eye Asymmetry)
      │
      ▼
Temporal Feature Generation
      │
      ▼
Machine Learning Models
(Random Forest, XGBoost, CNN-LSTM)
      │
      ▼
Ensemble Decision Layer
      │
      ▼
Driver State Classification

Driver States

Class Description
Alert Driver is attentive and focused
Fatigued Fatigue-related behavioral patterns detected
Distracted Signs of cognitive distraction detected


Dataset

The project utilizes publicly available driver monitoring datasets including:

  • NTHU Driver Drowsiness Detection Dataset
  • YawDD Dataset

Due to dataset licensing and repository size constraints, raw datasets are not included in this repository.


Tech Stack

Languages

  • Python

Computer Vision

  • OpenCV
  • MediaPipe

Machine Learning

  • Scikit-Learn
  • XGBoost
  • Random Forest

Deep Learning

  • TensorFlow
  • Keras

Data Processing

  • NumPy
  • Pandas

Visualization

  • Matplotlib
  • Seaborn

Repository Structure

.
├── train_data/
├── buildframefeature.py
├── extract_feature.py
├── extract_temporal_features.py
├── extract_window_features.py
├── train_model.py
├── train_short_only.py
├── demo.py
├── requirements.txt
└── README.md

Installation

git clone https://github.com/AnweshSinha/driver-cognitive-state-analysis.git

cd driver-cognitive-state-analysis

pip install -r requirements.txt

Running the Project

Generate frame-level features:

python buildframefeature.py

Extract temporal features:

python extract_temporal_features.py

Train the classifier:

python train_model.py

Run real-time inference:

python demo.py

Future Improvements

  • Vision Transformer based architectures
  • Attention-enhanced temporal modeling
  • Edge deployment optimization
  • Low-light robustness improvements
  • Driver alert generation system

Authors

Anwesh Sinha Ayush Thakur Ayush Rawat

Jaypee University of Information Technology


License

This project is intended for academic and research purposes.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages