Skip to content

Latest commit

ย 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

SmartDriverVision

AI-Powered Real-Time Driver Monitoring System

SmartDriverVision is a real-time driver monitoring system that leverages Computer Vision and Deep Learning to detect drowsiness and distracted driving. Using YOLOv8, MediaPipe Face Mesh, and OpenCV, the system continuously analyzes the driver's facial expressions, eye state, head orientation, and phone usage to estimate a driver risk score and issue real-time alerts.


๐Ÿ“Œ Features

  • ๐Ÿ‘๏ธ Real-time Eye Closure Detection
  • ๐Ÿ˜ด Microsleep Detection
  • ๐Ÿ˜ฎ Yawn Detection
  • ๐Ÿ“ฑ Phone Usage Detection
  • ๐Ÿงญ Head Pose Estimation
  • โš ๏ธ Dynamic Driver Risk Score
  • ๐Ÿ”Š Audio Alert System
  • ๐Ÿ“Š Live Driver Monitoring Dashboard
  • ๐ŸŽฅ Real-time Webcam Processing

๐Ÿ› ๏ธ Tech Stack

  • Python
  • OpenCV
  • YOLOv8 (Ultralytics)
  • MediaPipe Face Mesh
  • PyQt5
  • NumPy
  • Pygame

๐Ÿ—๏ธ System Architecture

Webcam
   โ”‚
   โ–ผ
Frame Capture
   โ”‚
   โ–ผ
Face Detection (MediaPipe)
   โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
   โ–ผ             โ–ผ
Eye Detection   Mouth Detection
   โ”‚             โ”‚
   โ–ผ             โ–ผ
Microsleep      Yawn Detection
Detection
   โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
   โ–ผ               โ–ผ
Phone Detection   Head Pose Estimation
        โ”‚              โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
               โ–ผ
      Driver Risk Score
               โ–ผ
 Dashboard + Audio Alerts

๐Ÿš€ Key Functionalities

Eye State Monitoring

The system detects whether both eyes remain closed over consecutive frames to identify prolonged eye closure and microsleep events.

Yawn Detection

A YOLOv8 model classifies the driver's mouth region to identify yawning behavior and estimate yawn duration.

Phone Detection

The system continuously monitors the camera feed to detect mobile phone usage while driving and flags distracted driving events.

Head Pose Estimation

MediaPipe facial landmarks are used to estimate head orientation. Significant deviations from the forward direction are considered signs of distraction.

Driver Risk Score

A dynamic driver risk score is computed using multiple behavioral indicators:

  • Microsleep duration
  • Number of yawns
  • Phone usage
  • Head orientation
  • Eye closure frequency

The score updates continuously during runtime to provide an overall estimate of driver attentiveness.

Real-Time Dashboard

The PyQt dashboard displays:

  • Blink Count
  • Microsleep Duration
  • Yawn Count
  • Yawn Duration
  • Phone Detection Status
  • Head Pose Status
  • Driver Risk Score
  • Driver Safety Alerts

๐Ÿ“‚ Project Structure

SmartDriverVision/
โ”‚
โ”œโ”€โ”€ DrowsinessDetector.py
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ alarm.wav
โ”œโ”€โ”€ yolov8n.pt
โ”œโ”€โ”€ dataset.yaml
โ”œโ”€โ”€ runs/
โ”‚   โ”œโ”€โ”€ detecteye/
โ”‚   โ””โ”€โ”€ detectyawn/
โ”œโ”€โ”€ screenshots/
โ””โ”€โ”€ .gitignore

โš™๏ธ Installation

Clone the repository

git clone https://github.com/anvi-tandel/SmartDriverVision.git
cd SmartDriverVision

Create a virtual environment

python -m venv venv

Activate it:

Windows

venv\Scripts\activate

macOS / Linux

source venv/bin/activate

Install dependencies

pip install -r requirements.txt

โ–ถ๏ธ Running the Application

python DrowsinessDetector.py

Allow camera access when prompted.


๐Ÿ“ˆ Driver Risk Score

The overall driver risk score combines multiple behavioral indicators.

Parameter Contribution
Eye Closure High
Microsleep Duration Very High
Yawn Frequency Medium
Phone Usage High
Head Pose Deviation Medium

The score updates in real time and helps identify unsafe driving conditions.


Demo

Normal Monitoring

dashboard

Phone Detection

phone detection

Drowsiness Alert

alert message

๐Ÿ”ฎ Future Improvements

  • Seatbelt Detection
  • Smoking Detection
  • Driver Identity Recognition
  • Night Vision Support
  • Cloud Dashboard
  • Driver Performance Analytics
  • Multi-Driver Monitoring
  • Mobile Application

๐Ÿ’ก Applications

  • Driver Monitoring Systems (DMS)
  • Fleet Management
  • Smart Transportation
  • Automotive Safety
  • Logistics & Commercial Vehicles
  • Advanced Driver Assistance Systems (ADAS)

๐Ÿ‘จโ€๐Ÿ’ป Author

Anvi Tandel

B.Tech, IIT (BHU) Varanasi

Interested in Machine Learning, Computer Vision, Data Science, and AI Systems.


About

AI-powered real-time driver monitoring system using YOLOv8, MediaPipe, and OpenCV for drowsiness, phone usage, head pose estimation, and driver risk assessment.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages