Inspiration
Driver fatigue and drowsiness can reduce attention and reaction time and may increase the risk of road accidents. I wanted to explore how deep learning and computer vision could be applied to recognize visible signs of drowsiness using images and an ordinary camera-based setup.
What it does
The Driver Drowsiness & Yawn Detection System uses a Convolutional Neural Network (CNN) to classify images into four categories:
- Open — eyes are open
- Closed — eyes are closed
- Yawn — yawning is detected
- No Yawn — no yawning is detected
The trained model can make predictions on new images and provides a foundation for developing a real-time driver-monitoring system.
How we built it
I developed the project using Python, TensorFlow/Keras, OpenCV, NumPy, and Matplotlib.
The development process included:
- Preparing and organizing the image dataset.
- Resizing and preprocessing the images.
- Applying data augmentation to improve model generalization.
- Designing and training a CNN for four-class classification.
- Evaluating the model using accuracy, precision, recall, F1-score, and a confusion matrix.
- Saving the trained model for future predictions and integration.
Challenges we ran into
One of the main challenges was achieving consistent performance across all four classes. The Open and Closed classes were easier for the model to distinguish when the visual features were clear, while Yawn and No Yawn were more challenging.
I also had to work with dataset preparation, image preprocessing, augmentation, and the difference between training and validation performance. These challenges helped me understand that model performance depends heavily on the quality and diversity of the data, not just the CNN architecture.
Accomplishments that we're proud of
I am proud of completing an end-to-end deep-learning project, from dataset preparation and preprocessing to model training and evaluation.
The model achieved approximately 75% validation accuracy, with F1-scores of approximately 0.91 for Closed, 0.90 for Open, 0.68 for No Yawn, and 0.49 for Yawn.
Another accomplishment was saving the trained model so it can be reused for predictions without retraining the network from scratch.
What we learned
This project gave me practical experience with the complete machine-learning workflow, including image preprocessing, data augmentation, CNN architecture, model training, and evaluation.
I also learned why accuracy alone is not enough to understand a classification model. Precision, recall, F1-score, and the confusion matrix provide additional insight into how well the model performs for individual classes.
Most importantly, I learned that building an AI application involves understanding the data, analyzing model weaknesses, and improving the system—not simply training a model and looking at its accuracy.
What's next for Driver Drowsiness & Yawn Detection System
The next stage is to turn the trained model into a more comprehensive real-time driver-monitoring system.
Planned improvements include:
- Real-time webcam-based detection
- Combining eye-closure and yawning indicators
- Driver distraction and head-pose detection
- A driver-risk scoring mechanism
- Real-time audio alerts for potentially dangerous states
- Larger and more diverse datasets
- Exploring transfer-learning approaches to improve classification performance
The long-term goal is to develop an accessible AI-based driver-monitoring assistant that can recognize multiple visual indicators of unsafe driving in real time.