Driver Drowsiness Detection using face and eyes
recognition
1st Sai Pranav Chitta — AP21110020055 2nd B. Naga Sirini — AP21110020037
ECE Department ECE Department
SRM University Andhra Pradesh SRM University Andhra Pradesh
Amaravathi, India Amaravathi, India
3nd Irfan Khan — AP21110020076 4nd D. Sankeerth — AP21110020048
ECE Department ECE Department
SRM University Andhra Pradesh SRM University Andhra Pradesh
Amaravathi, India Amaravathi, India
Abstract—Drowsiness poses a significant risk to safety in many of the most reliable and non-invasive indicators of a person’s
situations, particularly during tasks like driving. To address this alertness level.
issue, we propose a real-time computer vision system that detects Several research efforts have developed drowsiness detec-
drowsiness by monitoring a person’s eyes using a standard we-
bcam. Our system employs pre-trained Haar cascade classifiers tion systems using eye tracking [8]-[10]. However, many
to robustly detect the face, left eye, and right eye regions in each existing approaches require specialized hardware like infrared
frame of the video stream. The isolated eye images are then pre- cameras or electrooculography sensors, limiting their practi-
processed by converting to grayscale, resizing to 24x24 pixels, cality for widespread deployment.
normalizing pixel intensities, and reshaping to match the input
In this paper, we propose a real-time drowsiness detection
of a convolutional neural network (CNN).
The CNN, which was trained on a dataset of open and closed system using only a standard RGB webcam. Our system uses
eye images, classifies each eye as either open or closed. Our Haar cascade classifiers [11] to detect the face and eyes, and
system maintains a running score that increments when both a convolutional neural network (CNN) to classify eye state
eyes are classified as closed in a frame and decrements when as open or closed. By monitoring the duration of eye closure
either eye is open. If this score exceeds a defined threshold (e.g., over consecutive frames, our system can infer the onset of
15 consecutive frames with closed eyes), the system triggers an
audible alarm and draws a prominent red border around the drowsiness and alert the user.
frame to alert the user that they may be drowsy. We tested our
system in real-world conditions and found it to be effective at II. M ETHODOLOGY /S YSTEM M ODEL
detecting drowsiness with few false positives. A. System Overview
The proposed system provides a practical, non-invasive, and
real-time approach for enhancing safety in drowsiness-critical Our drowsiness detection system (Fig. 1) uses a webcam to
situations. Potential applications include integration into vehicle capture real-time video of the user’s face. For each frame, it
driver monitoring systems, industrial and construction safety performs the following steps:
gear, and alertness monitoring in jobs requiring sustained vigi-
lance. 1) Detect the face and eyes using Haar cascade classifiers.
2) Isolate and preprocess the eye regions.
I. I NTRODUCTION 3) Classify each eye as open or closed using a CNN.
Drowsiness is a major cause of accidents in situations that 4) Update the drowsiness score based on the eye states.
require sustained alertness, such as driving, operating heavy 5) Trigger an alert if the score exceeds a threshold.
machinery, or monitoring critical systems. Studies estimate
that 1-3% of all motor vehicle crashes and fatalities are B. The Model Architecture
attributable to drowsy driving [2]. Traditional methods for The model utilized in this project is developed using Keras
detecting drowsiness, such as self-reporting or monitoring and is based on Convolutional Neural Networks (CNNs).
hours of service, are often unreliable or impractical. CNNs are a specialized type of deep neural network that
In recent years, computer vision techniques have shown excel in image classification tasks. They consist of three
promise for automatic, real-time detection of drowsiness based main components: an input layer, an output layer, and one
on visual cues like facial expressions, head pose, and eye or more hidden layers. The convolutional process within these
closure. Among these, monitoring eye state is considered one networks involves applying a filter that performs 2D matrix
Fig. 1. Block diagram for the proposed system.
multiplication on the input data and the filter, enabling the
extraction of essential features across layers.
The CNN model architecture consists of the following layer:
• Convolutional Layer: 32 nodes, kernel size 3 × 3
• Convolutional Layer: 32 nodes, kernel size 3 × 3
• Convolutional Layer: 64 nodes, kernel size 3 × 3
• Fully Connected Layer: 128 nodes
The final layer is a fully connected layer with two nodes. A
ReLU activation function is applied in all layers except the
output layer, where a Softmax activation function is used.
C. Work Flow of our Model
The workflow can be summarized as follows:
1) Input: The system takes a video stream or input image.
2) Human Face Tracking:
• The input undergoes preprocessing.
• Algorithms are applied for detecting and tracking
the human face.
3) Feature Extraction:
• Key facial regions are identified.
• Eye regions are isolated for further analysis.
4) Evaluation: The system evaluates whether both eyes are
closed.
5) Alert: If both eyes are detected as closed, an alarm is Fig. 2. CNN model architecture.
triggered.
III. A LGORITHM
The approach for the Python project is structured as follows:
1) Capture an image from the webcam.
• The webcam is accessed in a loop to capture video
frames continuously.
• Each frame is processed and stored in a variable for
further analysis.
2) Detect the face in the image and create a Region of
Interest (ROI).
• The captured image is converted to grayscale, as
face detection algorithms work on grayscale images.
• A Haar Cascade classifier is used to detect faces in
the image.
• Bounding boxes are drawn around detected faces,
and the region containing the face is extracted for
further processing.
3) Detect the eyes from the ROI and feed them into the
classifier.
• Eye detection is performed within the face ROI
using Haar Cascade classifiers.
• The detected eye regions are extracted from the
image, isolating them for further analysis.
• These extracted eye regions are prepared as input
for the CNN classifier.
4) Classify eye state using the CNN model.
• The eye images are preprocessed by converting
them to grayscale, resizing to match the input size of
the model, normalizing pixel values, and reshaping
them as required.
• A pre-trained CNN model is used to predict the state
of each eye (open or closed).
5) Calculate the drowsiness score.
• The drowsiness score is updated based on the state
of the eyes:
– The score increases when both eyes are detected
as closed.
– The score decreases when eyes are detected as
open.
• A threshold is defined to determine drowsiness. If
the score exceeds the threshold, the system triggers
an alert to indicate drowsiness.
• The status of the eyes and the drowsiness alert are
displayed on the screen in real time.
IV. R ESULTS
The proposed system leverages deep learning for real-time
drowsiness detection, effectively distinguishing between open
and closed eye states using pre-trained models. The integration
of a camera feed, Haar cascade classifiers, and a trained CNN-
based eye detection model ensures robust monitoring. The
system produces an alert when the user exhibits signs of Fig. 3. Complete Algorithm Flow Chart
drowsiness, as indicated by a high score due to prolonged
eye closure.
tion in challenging environments and optimizing the model for
faster inference on low-power devices.
V. C ONCLUSION
The Accident Reduction Aid system developed is a highly
effective solution for detecting drowsiness in drivers in real-
time. By distinguishing between normal eye blinks and signs
of drowsiness, the system plays a crucial role in preventing
drivers from slipping into a state of sleepiness, thereby signifi-
cantly reducing the risk of accidents. The system is designed to
function efficiently under various conditions, including when
drivers wear spectacles or in low-light environments, ensuring
reliable performance at all times.
Through continuous monitoring of the driver’s eye status,
the system can accurately detect whether the eyes are open
or closed. If the system detects that the eyes remain closed
Fig. 4. Image 1.
for more than two seconds, an alarm is triggered, providing a
timely warning to the driver. This proactive alert system is a
1. Image 1: - The system detects the subject’s eyes as powerful tool in maintaining driver vigilance and preventing
open, assigning a score of 0, which indicates the absence of the onset of fatigue-related accidents. By alerting drivers in
drowsiness. A label ”Eyes Open” is displayed, and no alert is critical moments, this system contributes to safer driving,
triggered. This demonstrates the system’s ability to differenti- reduces the likelihood of accidents, and ultimately enhances
ate between normal (awake) states and potential drowsiness. both driver and vehicle safety, ensuring a more secure road
environment for all.
Fig. 5. Image 2.
2. Image 2: - When both eyes are detected as closed, the
system increments the score by one per frame. Once the score
crosses a threshold (e.g., 15), it activates an alert (visualized
by the red border). This image shows the system’s capability
to detect prolonged eye closure and its potential to prevent
accidents by providing timely warnings.
The system operates in real-time with minimal lag and
accurately tracks eye states using convolutional neural network
predictions. It can reliably alert users during scenarios such as
fatigue-induced drowsiness, making it ideal for applications in
driver safety systems and monitoring tasks requiring prolonged
attention.
While effective, the system’s performance can degrade un-
der low lighting or occluded conditions. Future enhancements
may involve integrating infrared imaging for improved detec-