Skip to content

RishikaSaria/DriverDrowsiness

Repository files navigation

DriverDrowsinessDetection

This repository contains the implementation of a Driver Drowsiness Detection System using Neural Networks. The system is designed to monitor a driver's facial expressions and alert them in real-time if signs of drowsiness are detected. It utilizes deep learning techniques to analyze the driver's facial features and predict their level of alertness.

The dataset used has been taken from kaggle

Link of the dataset: https://www.kaggle.com/datasets/ismailnasri20/driver-drowsiness-dataset-ddd
Properties of the dataset:
• RGB images
• 2 classes (Drowsy & Non Drowsy)
• Size of image : 227 x 227
• More than 41,790 images in total

Our implementation consists of the following steps:

• Extracting facial landmarks using dlib
• Calculating various ratios that are considered to be the estimators of the drowsiness level of an individual

The various ratios used were:

• Eye aspect ratio
• Mouth aspect ratio 
• Pupil circularity 
• Mouth over Eye ratio 

• Training a neural network that takes as input the ratios obtained in the previous step and asigns a score between 0 and 1 denoting the drowsiness level ( 1 being drowsy )

The neural net consists of:

• Layers : 9 hidden layers, 1 input layer, 1 output layer 
• Activation Function : RELU  
• Last Layer activation function : Sigmoid 
• Loss Function : Binary Cross Entropy Loss  
• Optimizer : Adam  

• Maintaining an Exponential Moving Average (EMA) of the drowsiness score obtained from the output of the neural network on the individual frames captured by the driver's camera sequentially and producing an alert message when the EMA crosses a certain threshold.

EMA features:

• Weightage : 0.6 for new frame 
• EMA initialization value : 0.0 (Considering driver is not drowsy at the initial moment) 
• EMA refresh rate : 10 frames 

Frameworks used: Pytorch, Scikit-Learn, dlib, opencv, numpy, pandas, imutils

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •