# Driver Identification and Detection of Drowsiness while Driving
## 3 Requirements and Technologies  
The aim of this study is two-fold. Firstly, a program was developed to perform facial recognition of a driver when they attempt to start the vehicle to verify whether that person is authorized to drive it or not. In order to achieve this, the Python [24] library for face recognition was used, which calculates the facial embedding of the driver's face and compares it with known and authorized faces. Secondly, a phase of research was carried out on the various existing approaches to detect driver drowsiness, identifying three main types of techniques for the detection of driver drowsiness based on the physiological characteristics of drivers, artificial vision techniques for driver tracking, and vehicle driving patterns. On the one hand, in this research, the method based on vehicle driving patterns was discarded due to the cost factor, as one of the main objectives was to create a system that could be used in any vehicle. On the other hand, this work focuses on driver identification using video and artificial vision techniques to track the driver and detect drowsiness, specifically, taking the face, eyes, and mouth as key points for driver identification and drowsiness detection.  
The main technologies used for facial recognition are detailed below. In particular, the implementation uses the Python face recognition library [25] to process detected faces and calculate facial embeddings. In order to detect a driver's face, OpenCV [26], which is an artificial vision library that not only detects faces but also identifies their components, such as eyes, nose, and mouth, was used. As for the requirements of this part, it was necessary that at the time of purchasing the vehicle, the dealership personnel or a specialized company load the facial biometric data of authorized individuals along with their names. In this way, each time an attempt is made to start the vehicle, the camera inside will be activated, and the data stored in the database of authorized drivers will be compared to the set of facial features of the person present in the vehicle at that moment.  
In the drowsiness detection phase, the main goal was to detect the face and eyes to identify characteristic signs of sleepiness, such as prolonged eye closure. Additionally, to perform this task, ML was used, specifically a model built using a CNN, where the proposed system was implemented using the Python language, the deep learning framework Keras [27], and the computer vision library OpenCV.  
This work has several pre-requisites. Firstly, there must be a camera inside the vehicle to capture images of the driver through a Jetson Nano (see Figure 2). Secondly, several software tools are required. For instance, Python, the programming language used for development, must be installed to use the necessary packages. Furthermore, the open-source computer vision library OpenCV is required for face and eye detection, the framework Keras is required for creating the classification model, and the cross-platform Pygame [28] Python modules for playing the alarm sound that wakes up the driver are also needed.  
Finally, the server makes use of Docker [29] to encapsulate an application and its dependencies in an isolated and portable environment, facilitating its deployment and distribution in different runtime environments. It provides greater flexibility and efficiency in server resource management and simplifies application deployment because this approach involves encapsulating both code and dependencies in a self-contained container. Moreover, compatibility issues between environments were reduced, ensuring that the application runs the same way on any server where it is deployed.