# AI- and Deep Learning-Powered Driver Drowsiness Detection Method Using Facial Analysis
## 3 Proposed Methodology  
The aim of this work was to evaluate the effectiveness of various deep learning algorithms that incorporate facial expressions, physiological indicators, and driver behavior analysis in a driver drowsiness detection system. The research focused on creating and assessing this system using deep learning techniques, utilizing two datasets, the Kaggle Yawn Eye dataset, which includes RGB images, and a subset of the Health Informatics dataset, containing grayscale images, to test model generalizability. The methodology involved pre-processing the images through resizing and labeling and employing Haar cascade classifiers to identify key features such as the eyes and mouth. Three deep learning models--a CNN, VGG16, and MobileNet--were selected for their effectiveness in image tasks and were trained using the Kaggle dataset with a 70:30 training-validation split. Their performance was evaluated using metrics such as accuracy, precision, recall, and the F1-score to ensure reliability. Additionally, the models were tested using the Health Informatics dataset to assess their adaptability to new data, while computational efficiency and training times were analyzed for potential real-time applications. To achieve this objective, the following approach was considered, as shown in Figure 3:  
1. Data collection: gather the necessary information for the project, which in this instance consists of images and videos that contain instances of yawning and eye closure. 2. Data pre-processing: pre-process the collected data to make them suitable for the model by resizing the images, converting them to grayscale and/or RGB, and labeling them. 3. Feature selection: determine the Region of Interest, the face and the eye region in the input images. 4. Model selection: select the appropriate models for the project, which in this case are a convolutional neural network (CNN), VGG16 architecture, and MObileNet architecture. 5. Model training: using the proper hyperparameters, such as the learning rate, number of epochs, batch size, and loss function, train the chosen model with the pre-processed and augmented data. 6. Model assessment: utilize the right assessment metrics, such as accuracy, precision, recall, and the F1-score, to assess the trained model. Accuracy: Accuracy (Equation (1)) provides a comprehensive evaluation of a model's predictive capabilities, revealing the percentage of instances where the algorithm successfully identifies and classifies data points. \[Accuracy=\frac{\text{Number of Correct Predictions}}{\text{Total Number of Predictions}} \tag{1}\]
* Precision: Precision is defined as the fraction of actual positives for all positive assertions. Precision (Equation (2)) assesses the accuracy of optimistic forecasts. \[Precision=\frac{\text{True Positives}}{\text{True Positives + False Positives}}\] (2)
* Recall: Recall is the proportion of true positives among all actual positives. A model's recall (Equation (3)) evaluates the efficiency with which it detects cases that are positive. \[Recall=\frac{\text{True Positives}}{\text{True Positives + False Negatives}}\] (3)
* F1-score: This is a complex statistical metric that combines precision and recall into a single, balanced metric. This indicator, which makes use of the harmonic mean (Equation (4)), provides a more comprehensive assessment of an algorithm's performance by incorporating a model's accuracy in predicting positive cases as well as its capacity to accurately identify them. \[F1-Score=2*\frac{\text{Precision }\times\text{Recall}}{\text{Precision + Recall}}\] (4)  
The accuracy score is a popular statistic used to determine the performance of classification models, but it may not be the best metric in all cases, especially if the classes are imbalanced. So, this research used other metrics like precision, recall, and the F1-score, which provided a better evaluation of the performance of the trained models.