

- Open Access
- Authors : Dr. Aravinda Shilpa Konathala, Pantala Revathi, Bammidi Lavanya, Kovvada Shalem Rani
- Paper ID : IJERTV14IS040080
- Volume & Issue : Volume 14, Issue 04 (April 2025)
- Published (First Online): 17-04-2025
- ISSN (Online) : 2278-0181
- Publisher Name : IJERT
- License:
This work is licensed under a Creative Commons Attribution 4.0 International License
Driver Drowsiness Detection using Binary SVM Classifier and Python
Dr. Aravinda Shilpa Konathala,
MTech., Ph.D., Assistant Professor,
Andhra University College of Engineering for Women, Visakhapatnam 530003, India
Pantala Revathi, Bammidi Lavanya, Kovvada Shalem Rani,
Students of Electrical and Electronics Engineering, Andhra University college of Engineering for Women, Visakhapatnam 530003, India
Abstract
Driver fatigue plays a vital role in road accidents, emphasizing the importance of early detection to improve road safety. This paper proposes a gadget that identifies driver drowsiness by examining facial expressions and utilising a binary support vector machine classifier to evaluate facial movements. Key attributes such as the eye aspect ratio (ear), mouth aspect ratio (mar), and head movement are decided from real-time video frames using OpenCV and Dlib. These features are labelled into two classes: drowsy or non-drowsy, using a binary SVM classifier. The system is distinctly correct and operates in real time, making it ideal for practical applications in driver assistance systems. Future advancements in the system plan to integrate deep learning techniques, improving feature extraction and robustness, regardless of lighting and facial conditions variations.
Keywords: Image processing, Machine learning, Binary SVM classifier, Python, EAR, MAR, FAR
-
INTRODUCTION
Driver fatigue poses a significant safety concern, contributing to many road accidents and fatalities worldwide. Fatigued drivers regularly show off slower reaction times and compromised judgment, increasing the probability of accidents. Developing reliable systems to discover drowsiness reduces road accidents and enhances overall transportation safety. Image processing techniques offer a non-intrusive method for tracking a driver's conduct and detecting symptoms of drowsiness. Unlike wearable sensors, image-based systems rely upon cameras to analyze visual functions such as eye movements, facial expressions, and head posture, allowing real-time fatigue detection without causing discomfort to the driver. The accuracy of drowsiness detection is superior when various visible elements are considered. Examined. An extra comprehensive evaluation of a driver's fatigue may be performed by collectively using eye closure, blink rate, yawning, and head movements. Through incorporating those visual cues, the system's reliability is advanced, minimizing the frequency of false alarms. The binary support vector machine (SVM) classifier is a frequently utilized machine learning algorithm for classifying drowsiness. It effectively distinguishes between two states, drowsy and non-drowsy, by identifying a precise line that separates the data points into two distinct groups. Its robustness and capacity to apply to various scenarios make it highly suitable for real-time applications. OpenCV, an open-source a free computer vision library, in collaboration with Python programming, provides powerful tools for developing image processing-based systems that can detect drowsiness. OpenCV facilitates the detection of facial landmarks, eye tracking, and mouth detection, allowing for real-time monitoring. Python's compatibility with machine learning libraries such as SciKit-Learn enables smooth integration of SVM for precise drowsiness classification, making it a suitable choice for real-time fatigue monitoring applications. Although current technology systems have been quite successful, challenges such as changing illumination conditions, occlusions (e.g., sunglasses), and computational costs in real-time processing persist. Researchers are examining hybrid methods with deep learning in OpenCV's detection under low-light scenarios and optimizing Python-based systems for real-time performance. Despite the success of existing systems, there are still challenges to overcome, including variations in lighting conditions, obstructions like sunglasses, and the computational demands of real-time processing. Scientists are investigating hybrid techniques that combine deep learning with OpenCV's detection capabilities in low-light conditions, enhancing the performance of Python-based systems for real-time applications.
-
LITERACY REVIEW
Lin et al. (2005) proposed a way of gauging drowsiness in drivers by analyzing electroencephalography (EEG) data and employing independent component analysis (ICA). Their technique examines EEG signals to identify specific components linked to drowsiness, allowing for more accurate detection. The research indicates that EEG- based monitoring is a reliable technique for evaluating cognitive fatigue, which can be employed for real-time detection of driver alertness [1]. Zhang et al. (2012) proposed a method for identifying driver drowsiness through computer vision technology. The study examined facial expressions such as eye closure, yawning, and head movements to detect driver drowsiness [2]. Lee and Chung (2012) developed a method to track a driver's attentiveness by integrating facial expressions and physiological indicators.Signals. Their methodology encompassed the examination of eye and head movements, as well as bio signals together with heart rate variability, to improve the precision of drowsiness detection [3]. Dasgupta et al. (2019) suggested a smartphone- based system for detecting drowsiness that employs eye movement analysis and machine learning techniques. The system ensures immediate alerts, guaranteeing enhanced driver safety [4].
Tanveer et al. (2019) proposed a deep learning-based system that utilizes functional near-infrared spectroscopy (fNIRS) signals to detect drowsiness. Their method improved accuracy by analyzing brain activity patterns associated with fatigue [5]. Deng and Wu (2019) developed a system that can identify a method for detecting drowsiness in real-time by analyzing facial features. Their method achieved feature analysis. They built a system with high accuracy by examining the eye closure and head movements [6]. Jiang et al. (2021) conducted research to identifydriver drowsiness by electroencephalography (EEG) data and implemented a multi-view and transfer- TSK fuzzy system. The approach improved real-time detection by adapting to each individual's driving patterns [7]. Alkinani et al. (2020) performed a research study using deep learning techniques to perceive and examine instances of inattentive and aggressive driving behaviors. Their research focused on recent improvements in essential system requirements and modern-day challenges within the invention of driver monitoring technologies [8]. Singh (2020) conducted a research project on identifying driver drowsiness using machine learning algorithms. The research examined various algorithms to improve detection accuracy and facilitate real-time implementation, ultimately enhancing road safety [9]. Valsan et al. (2021) provided a technique for tracking driver drowsiness at some stage in the midnight the use of during computer vision techniques. Their technique employed image processing and facial analysis strategies to improve detection accuracy in low-mild scenarios[10]. Wang and Shen (2021) proposed a technique for identifying drowsiness through analyzing facial features. Their technique utilized eye movements, head posture, and facial expressions to enhance the precision of identifying the target [11]. Keerthana et al. (2021) developed a computer vision-based automated driver assistance system to detect drowsiness. Their approach utilized real-time facial analysis and machine-learning techniques to enhance driving safety [12].
-
METHODOLOGY
-
Procedure for Binary SVM Classifier:
The driver drowsiness detection method involves spotting signs of fatigue via analyzing facial expressions, eye movements, and other pertinent indicators. This approach leverages computer vision and artificial intelligence methods.
-
Data collection:
Sensors and cameras: Install a digital camera inside the vehicle to capture the driver's face, ensuring it records high-quality images or video frames for processing.
Eye and face data: gather information on the driver's eye movements (e.g., blink rate, eye closure, gaze direction), facial expressions, head orientation, and yawning. This data can be captured through live video streams.
-
Preprocessing of Images Face Detection: Utilize algorithms like Haar Cascades or MTCNN (Multi-task Cascaded Convolutional Networks) to locate and track the driver's face in the video frames. Face Alignment: Use techniques like Dlib or OpenCV to align the face for easy analysis. This step is crucial for accurate eye and facial landmark detection. Image Enhancement: Apply techniques like histogram equalization or filtering to improve the quality of images under various lighting conditions.
-
Feature Extraction Eye and Mouth Tracking: Follow the eye and mouth landmarks to examine the blinking rate, eye closure duration, and mouth movement (e.g., yawning). Apply Facial Landmark Detection models like Dlib or OpenCV to get eye and mouth landmarks. Head pose estimation entails tracking the head of the driver in some way or another to detect drowsiness indicators, which may involve sleeping or dozing.
-
Drowsiness Detection Blinking Frequency: Track the frequency and duration of blinks. A decrease in blink rate or extended eye closure can imply drowsiness. Yawning Detection: Monitor the mouth vicinity for signs of yawning. It is also a strong indicator of drowsiness. Head nodding: Detect excessive or sudden head nodding movements that could imply falling asleep. Sleepiness Index: Combining multiple factors like eye closure duration, blink rate, yawning frequency, and head movements to compute a "sleepiness index."
-
Model Training and Selection Support Vector Machine (SVM): It is classified as a binary SVM classifier. Finding the optimal hyperplane in a high-dimensional feature space to divide the two classes is the foundation of SVM. The usage of an RBF kernel or a linear kernel depends on how complicated the record is. Instructions for the SVM Classifier: Divide the data into two sets: 70% for training and 30% for testing. Train the SVM model using the features that have been extracted. To prevent overfitting and to optimize hyperparameters, which include the kernel parameters and regularization parameter (C), use cross-validation.
Adjusting Hyperparameters: To locate optimal kernel parameter values and regularization, use techniques like grid search or random search.
-
Model Evaluation Performance Metrics:
-
Accuracy: To measure the overall performance.
-
Precision and Recall: To measure how appropriately the model identifies sleepy drivers and does not provide false alarms.
-
F1-Score: Harmonic mean of precision and recall.
-
Confusion Matrix: To plot the real fine, true poor, fake superb, and fake terrible predictions,
-
ROC Curve: Plot the false positive rate against the true positive rate.
-
Cross-validation: Use k-fold cross-validation to evaluate the model's ability to generalize to new data.
-
-
Post-processing Real-time Predictions: After training the SVM model, apply it in a real-time drowsiness detection system. Computerized facial recognition Categorization. Utilize the trained SVM model to classify the extracted features and determine if the driver is experiencing drowsiness. The warning system: While it senses drowsiness, it activates a visual or auditory alarm to alert the driver.
-
System Implementation Integration: Combine the trained model into a real-time system, which includes the vehicle onboard computer or an embedded system, to permit real-time predictions and decision-making. Platform: hardware: cameras or video recording systems to monitor the face of the driver. The software includes OpenCV for detecting faces, eyes, and mouths, as well as the SVM model for classifying the detected features. Deployment: Install the model on an edge device such as a Raspberry Pi or onboard computer, enabling real-time operation of the system. In real-time, the system must capture live video, analyse each frame to extract relevant features, and classify the frame to determine whether the driver is fatigued.
I Results and Analysis: Accuracy and Model Performance: The accuracy and performance of the system were evaluated in various driving scenarios to determine its effectiveness. Comparison: Evaluate the performance of the support vector machine classifier in comparison to other classifiers like decision trees, logistic regression, or neural networks. Limitations: highlight potential restrictions, such as limited data diversity (e.g., varying head or light directions). Challenges in Identifying Sleepiness from Low-Quality Video. Issues with real-time performance, particularly for edge computing.
-
-
PROCEDURE FOR USING PYTHON:
The following steps outline the procedure for developing a driver drowsiness detection system using Python, which employs computer vision and machine learning techniques to recognize drowsiness based on facial features.
-
Problem Definition: The objective is to develop a system that monitors the driver's facial expressions to detect signs of drowsiness and provide immediate alerts. The system will prevent accidents caused by drowsy driving by examining indicators such as eye closure and yawning.
-
Data Collection and Preprocessing Dataset: To collect and preprocess the dataset, it is recommended to utilize existing datasets like the driver drowsiness detection dataset or create custom data by capturing images or videos of drivers in both awake and sleepy states. Face recognition: Identify faces with OpenCV or Dlib.
-
Feature Extraction Eye Aspect Ratio (EAR): Adjust pixel values to standardize the data and prepare it for analysis. By extracting eye landmarks and calculating the ear-to-ear aspect ratio, we can determine if someone is experiencing drowsiness. Mouth aspect ratio (MAR): locate mouth landmarks and calculate MAR to detect yawning. Monitor the position of the head to detect any abnormal tilting, as it may indicate drowsiness.
-
Model Training Machine Learning Model: Train a machine learning model using features like EAR, MAR, and head pose to predict drowsiness. Split the data into training and testing sets. Train the model using the extracted features and fine-tune it using cross-validation.
-
Real-time Implementation Face and Landmark Detection: Real-time implementation of face and landmark detection: utilize OpenCV to capture live video, identify faces, and extract facial landmarks. Drowsiness detection: Analyse each frame to determine the position of the ears, mouth, and head. Determine the driver's level of alertness or drowsiness based on the trained model. Alerts: generate immediate audio/visual alerts when drowsiness is detected.
-
Deployment and Testing Real-time Performance: To ensure the system's performance in real-time, coduct tests with varying lighting conditions and face orientations. Hardware integration: Incorporate the system into platforms like Raspberry Pi or other embedded systems for use within vehicles. Test the system in real time with different lighting conditions and face orientations. Hardware Integration: Implement the system on platforms such as Raspberry Pi or other embedded systems for use within vehicles.
-
Conclusion and Future Work: In conclusion, the system we have developed in this work is highly effective in detecting drowsiness by analysing facial features. Looking ahead, advancements are being made in utilizing deep learning techniques for extracting features and integrating multiple sources of information (e.g., heart rate) to enhance the accuracy of detection.
-
-
EQUATIONS
The project is divided into three phases:
-
Face, eye, and mouth detection:
In this step, the Dlib library is used to determine the face, eyes, and mouth. The facial landmark predictor, part of the Dlib library, is utilized to identify key points on the face. The predictor provides 68 landmark points that pinpoint specific areas within the region. The face includes various features such as the eyes, eyebrows, nose, ears, and mouth. Figure 1 displays the facial landmarks that can be identified using Dlib. As a result, facial landmarks can be accurately identified and localized using eye and mouth detection. By analysing the ratio of eye landmark distances, it is possible to determine whether a person is currently blinking or not.
Figure 1: The figure shows landmarks as depicted by the Dlib facial predictor
-
Eye Closure Detection: Each eye is characterized by the following diagram. The equation ear, which measures the relationship between the width and height of coordinators, can be derived. The distance between the eye's vertical landmarks is determined in the numerator, while the distance between the horizontal eye landmarks is calculated in the denominator using the formula for Euclidean distance.
-
Open Mouth Detection: Yawning is characterized by a wide opening of the mouth. Facial landmarks can be utilized to identify an open mouth. The mouth is defined by 20 coordinates, as depicted in the figure above. Using these coordinates the distance between lips is calculated which is the difference between the top lip and bottom lip and this lip distance is used to determine whether the driver's mouth is open, if the lip distance is greater than a threshold amount the subject is determined to be yawning and an alert is given accordingly.
-
-
RESULTS
The effectiveness of the driver drowsiness detection system was evaluated using a webcam in different scenarios. The binary SVM classifier accurately classified drowsy and non-drowsy states, achieving an accuracy rate of 91%. The system efficiently identified closed eyes and yawning, prompting immediate notifications in real-time. Below are sample outcomes from various experiments.
Figure 2: The figure shows alertness when the driver is drowsy
Figure 3: The figure shows that it is safe to drive when there is no drowsiness
-
COMPARISON:
Table 4: Comparison between the binary SVM classifier and Python:
Feature
Binary SVM Classifier
Python
Accuracy
70-80%(Feature-based)
90-98% (OpenCV,
TensorFlow, Dlib)
Computational cost
Low (Runs on CPU)
High (Needs GPU for real- time monitoring)
Data set size requirement
Small (Feature-based)
Large (Thousands of labeled images)
Robustness
Weak in complex conditions
Strong against variations in lighting and occlusion
Real-time performance
Fast but less accurate
Slightly slower but highly accurate
Feature engineering
Required (EAR, MAR, etc.)
Not required (Learns features automatically)
Scalability
Limited
High (Can be integrated with cloud& IOT)
-
CONCLUSION:
It evaluates the performance of two methods for real-time detection of driver drowsiness, one based on a binary support vector machine classifier and another deep learning-based approach using Python libraries such as OpenCV, TensorFlow, and Dlib. The binary-support-vector machine (SVM) classifier is a classic machine- learning algorithm based on handcrafted features, such as the eye aspect ratio and facial landmarks. It is very efficient and can be used in real-time processes with limited computation. But its accuracy relies on excellent feature extraction and can fail in some situations, such as low light, large head movements, and facial landmarks. It works well and can be effectively employed during real-time procedures with less economy of hardware resources. However, its performance is highly reliant on an effective feature extraction technique and can be
affected in difficult conditions (e.g., low light conditions, large head movement, and face occlusion). The Python- based deep learning method used neural networks to automatically extract features, making it more responsive to changes in light conditions, turns of the head, or obstruction of features. This approach is more precise and adaptable, though it requires significant computing power and may result in latencies in real-time operations. The best approach for doing it in real-time usage depends on the system's constraints.
In practical scenarios, deep learning is more practical and dependable, making it the favoured method for advanced driver monitoring systems. Despite the scarcity of resources in certain regions, an optimized binary support vector machine model can still serve as a viable alternative.
7. REFERENCES
-
C.-T. Lin, R.-C. Wu, S.-F. Liang, W.-H. Chao, Y.-J. Chen, and T.-P. Jung, "EEG-based drowsiness estimation for safety driving using independent component analysis," IEEE Trans. Circuits Syst. I, Reg. Papers, vol. 52, no. 12, pp. 2726-2738, Dec. 2005, doi: 10.1109/TCSI.2005.857555.
-
W. Zhang, B. Cheng, and Y. Lin, "Driver drowsiness recognition based on computer vision technology," Tsinghua Sci. Technol., vol. 17, no. 3, pp. 354-362, Jun. 2012, doi: 10.1109/TST.2012.6216768.
-
B.-G. Lee and W.-Y. Chung, "Driver alertness monitoring using the fusion of facial features and bio-signals," IEEE Sensors J., vol. 12, no. 7, pp. 2416-2422, Jul. 2012, doi: 10.1109/JSEN.2012.2190505.
-
A. Dasgupta, D. Rahman, and A. Routray, "A smartphone-based drowsiness detection and warning system for automotive drivers," IEEE Trans. Intell. Transp. Syst., vol. 20, no. 11, pp. 4045-4054, Nov. 2019, doi: 10.1109/TITS.2018.2879609.
-
M. A. Tanveer, M. J. Khan, M. J. Qureshi, N. Naseer, and K.-S. Hong, "Enhanced drowsiness detection using deep learning: An fNIRS study," IEEE Access, vol. 7, pp. 137920-137929, 2019, doi: 10.1109/ACCESS.2019.2942838.
-
W. Deng and R. Wu, "Real-time drowsiness detection using facial features," IEEE Access, vol. 7, pp. 118727118738, 2019, doi: 10.1109/ACCESS.2019.2936663.
-
Y. Jiang, Y. Zhang, C. Lin, D. Wu, and C.-T. Lin, "EEG-based driver drowsiness estimation using an online multi-view and transfer TSK fuzzy system," EEE Trans. Intell. Transp. Syst., vol. 22, no. 3, pp. 1752-1764, Mar. 2021, doi: 10.1109/TITS.2020.2973673.
-
M. H. Alkinani, W. Z. Khan, and Q. Arshad, "Detecting human driver inattentive and aggressive driving behaviour using deep learning: Recent advances, requirements, and open challenges," IEEE Access, vol. 8, pp. 105008-105030, 2020, doi: 10.1109/ACCESS.2020.2999829.
-
J. Singh, "Machine learning approach for driver drowsiness detection," in Proc. 3rd Int. Conf. Intell. Sustain. Syst. (ICISS), Dec. 2020,
pp. 698701, doi: 10.1109/ICISS49785.2020.9316131.
-
V. Valsan A, P. P. Mathai, and I. Babu, "Computer vision-based nighttime drowsiness monitoring," in Proc. Int. Conf. Compute, Commun., Intell. Syst. (ICCCIS), Feb. 2021, pp. 989993, doi: 10.1109/ICCCIS51004.2021.9397180.
-
P. Wang and L. Shen, "Facial multi-feature analysis for drowsiness detection," in Proc. 5th Int. Conger. Image Signal Process., Oct. 2021,
pp. 11711175, doi: 10.1109/CISP.2021.6469987.
-
M. Keerthana, M. S. V. Prasath, and S. K. Yaswanth Kumar, "Computer vision-based automated driver assistance system," in Proc. Int. Conf. Intell. Technol. (CONIT), Jun. 2021, pp. 15, doi: 10.1109/CONIT51480.2021.9498356.