Fatigue detection in vehicle drivers using Artificial Intelligence
La Paz. Deep Learning. 2021 Artificial vision tools have demonstrated time after time the great potential they have in their different application areas. One of these is precisely related to vehicles and their…
A learning project shared by the community. The article documents its team, methods and results; it does not establish that the prototype is ready for real-world use.

This archive includes automatic translations. Audio, video and text inside images remain in their original language.
La Paz. Deep Learning. 2021
Artificial vision tools have demonstrated time after time the great potential they have in their different application areas. One of these is precisely related to vehicles and their drivers. Ranging from autonomous mobility to tools for personal use, the spectrum is very broad. Therefore, this text explains the implementation of a fatigue detector in drivers through Artificial Intelligence using OpenCV and Dlib.

PROBLEM DESCRIPTION
Traffic accidents are one of the main causes of death in citizens of all countries. These can be classified according to their causes. It is estimated that between 20% and 30% of accidents are due to drivers driving while fatigued. While driving fatigue is an avoidable risk, unfortunately, many drivers do not take the necessary precautions when driving for prolonged periods of time. Therefore, drivers with fatigue can benefit from an Artificial Intelligence system that alerts them when they lose attention.
OBJECTIVE
Design a system to detect fatigue in drivers.
MODEL SELECTION
A pre-trained artificial vision model based on the OpenCV cv2 library and dlib was selected for facial detection.
TECHNIQUES IMPLEMENTED
- OpenCV: The free computer vision library being used to obtain the driver image.
- Dlib face landmarks: There are 68 points that are placed on the detected face to identify facial features, in this case the eyes.
- NumPy: This library is being used for the calculation of the eye opening ratio, using linear algebra and the positioning of the facial points of the eyes.
MODEL EVALUATION
The built system makes use of a pre-trained facial detection model. With the help of the previously mentioned libraries, a procedure is carried out as follows:
- The detector and predictor model is loaded, which are those that detect the driver's face as well as the 68 facial points.
- A linear function detects the aspect ratio in the eyes by measuring distances between eye points.
- Depending on the value obtained in this proportion, the program branches according to the state it considers corresponding (awake, tired or asleep). For the transition from one state to another to be considered, there must be a permanence in that state for a period of time.
- The system indicates the identified status on the screen; this is the step where an alarm may or may not be activated.
- This procedure is carried out frame by frame to have a constant prediction of the person's fatigue state.
ANALYSIS OF RESULTS
As a pre-trained model was used, the results obtained by the facial detector and the face reference points are good.

However, the results we obtained in detecting the fatigue state are rather fluctuating. Sometimes the system is not very sensitive and does not detect states with eyes closed or, on the contrary, the system is quick to indicate a possibly false state. Reasons that could cause this problem include video quality and exclusive focus on the driver's eyes (when other factors such as the mouth could be taken into consideration).

CONCLUSION
The project has developed a functional system capable of detecting fatigue in vehicle drivers. The consistency in these detections is not good, so some suggestions are proposed: Apply erosion and dilation operations to reduce noise in video capture, implement a system that detects the mouth opening ratio to increase consistency, and modify the detection thresholds to adjust to the needs of each driver.
MEMBERS
Carlos Claure –https://www.linkedin.com/in/carlos-manuel-claure-vargas-475226212
Raquel Calle –https://www.linkedin.com/in/raquel-veranda-calle-zapata-460226212
Clean Leaders –https://www.linkedin.com/in/limpiaslider/
Alejandro Carrasco. –https://www.linkedin.com/in/miguel-alejandro-carrasco-c%C3%A9spedes-785717215/
REFERENCES
https://www.pyimagesearch.com/2017/05/08/drowsiness-detection-opencv/
https://www.researchgate.net/figure/Variables-del-Perclos_fig1_325745828
Project presentation: DemoDay
More artificial intelligence!
The mission of Saturdays.ai is to make artificial intelligence more accessible (#ai4all) through intensive courses and programs where projects for good are carried out (#ai4good).
Explore our AI master’s programme at https://saturdays.ai/master-ia-online/
If you want to learn more about artificial intelligence join our community at community.saturdays.ai or visit us on our website www.saturdays.ai Join us! Saturdays.AI
WRITTEN BY
Raquel Calle
Saturdays.AI
Saturdays.AI is an impact-focused organization on a mission to empower diverse individuals to learn Artificial Intelligence in a collaborative and project-based way, beyond the conventional path of traditional education.
A history of the Saturdays.AI community. Originally published on Nov 21, 2021.
← More community stories




