Fatigue detection in vehicle drivers using Artificial Intelligence
A La Paz prototype uses OpenCV and dlib to explore signs of driver fatigue, with results and limitations explained by the team.
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.

La Paz. Deep Learning. 2021
Computer vision has applications ranging from autonomous vehicles to driver-assistance tools. In this project, we explore a prototype that looks for signs of fatigue using OpenCV and dlib.

PROBLEM DESCRIPTION
Fatigue can reduce attention at the wheel and increase crash risk. This project explores whether computer vision can recognise signs such as prolonged eye closure and trigger an alert. The prototype does not replace rest and has not been validated as a road-safety system.
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: The dlib predictor locates 68 facial landmarks; this project uses those around 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.
- We calculate the eye aspect ratio from distances between eye landmarks.
- Based on the ratio and how long it persists, the program assigns a label: awake, tired or asleep. These are threshold-based estimates, not direct measurements of fatigue.
- 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
In our tests, the pretrained model located faces and landmarks well enough for the prototype. That does not establish the reliability of fatigue detection.

Fatigue detection was inconsistent. Sometimes the system missed closed eyes; at other times it triggered a label too soon. Video quality and reliance on the eyes alone, without considering cues such as the mouth, may contribute to these errors.

CONCLUSION
We built a prototype that estimates signs of fatigue, but its detections are not yet consistent. Proposed improvements include testing erosion and dilation to reduce noise, adding mouth-opening measurements and adjusting thresholds. These changes require evaluation before real-world use is considered.
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
Liders Limpias –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!
Saturdays.AI makes AI more accessible through shared learning and projects with a social purpose. Our motto is AI4ALL IS AI4GOOD.
Meet the Saturdays.AI community
Written by
Raquel Calle
Saturdays.AI
Saturdays.AI is an open community for learning artificial intelligence, collaborating and building projects with social impact.
A story from the Saturdays.AI community. Originally published on Nov 21, 2021.
← More community stories




