Personal ProjectML/AI

Driver Drowsiness Detection System

An AI-powered real-time system that monitors driver alertness using computer vision and deep learning, providing immediate audio-visual alerts to prevent accidents.

Driver Drowsiness Detection System

Driver Drowsiness Detection System - AI Project

Project Overview

Driver Drowsiness Detection is an AI-powered real-time system designed to monitor driver and rider alertness. Using computer vision and deep learning, the system analyzes eye states through live video feeds and provides immediate alerts when drowsiness is detected, significantly enhancing road safety.

Key Features

  • Real-Time Eye State Detection: Continuous monitoring using CNN model predictions and Eye Aspect Ratio (EAR)
  • Face Mesh Detection: Utilizes MediaPipe with 468 facial landmarks for precise eye region extraction
  • Dual-Metric Validation: Combines deep learning predictions and geometric analysis for robust detection
  • Immediate Audio-Visual Alerts: Visual overlays and audio alarms triggered upon drowsiness detection
  • Prediction Smoothing: 5-frame history averaging reduces false positives
  • Adaptive Image Processing: CLAHE enhancement and Gaussian blur for varying lighting conditions
  • Configurable Thresholds: Adjustable sensitivity for different environments and drivers

Technical Stack

  • Programming Language: Python 3.x
  • Computer Vision: OpenCV, MediaPipe
  • Deep Learning: TensorFlow/Keras with pre-trained CNN model
  • Image Processing: CLAHE, Gaussian blur, image normalization
  • Audio Alerts: Windows sound system (winsound) with WAV file support
  • Numerical Computing: NumPy for array operations

Technical Implementation

The system follows this workflow:

  1. Webcam Capture → OpenCV grabs live video frames
  2. Face Detection & Eye Extraction → MediaPipe face mesh identifies 468 facial landmarks
  3. Image Preprocessing → CLAHE enhancement + Gaussian blur applied to eye region
  4. CNN Model Inference → Grayscale 64x64 images fed to model for drowsiness prediction
  5. Prediction Smoothing & EAR Calculation → 5-frame history averages reduce false alarms
  6. Drowsiness Decision Logic → Triggers audio and visual alerts in real time

Business Impact

  • Enhanced Safety: Reduces accidents caused by drowsy driving with immediate intervention
  • Cost-Effective Solution: Provides a scalable safety tool without expensive hardware
  • High Accuracy: Dual-metric approach ensures reliable detection in various environments
  • Edge Deployment: Can be integrated into vehicles or fleet monitoring systems for real-time safety
Chat on WhatsApp