Inspiration
Driver fatigue and drowsiness can reduce attention and reaction time and may contribute to road accidents. I wanted to explore how deep learning and computer vision could be used to recognize visible signs of drowsiness through an ordinary camera, without requiring specialized hardware.
What it does
The Driver Drowsiness and Yawn Detection System uses a Convolutional Neural Network (CNN) to classify facial images into four categories:
- Open — eyes are open
- Closed — eyes are closed
- No Yawn — no yawning is detected
- Yawn — yawning is detected
The trained model can then be used to make predictions on new images and serves as a foundation for a real-time driver-monitoring system.
How we built it
I built 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.
- Building a CNN for four-class image classification.
- Training the model on the prepared dataset.
- Evaluating its performance using accuracy, precision, recall, F1-score, and a confusion matrix.
- Saving the trained model for later predictions.
Challenges we ran into
One of the main challenges was getting the model to perform consistently across all four classes. Eye-state classification was relatively straightforward when the visual features were clear, while yawn and no-yawn images were more difficult to distinguish.
I also had to deal with challenges related to dataset preparation, choosing suitable preprocessing and augmentation techniques, and understanding the difference between training and validation performance.
Accomplishments that we're proud of
I am proud of completing the project as an end-to-end deep-learning workflow rather than stopping at model training.
The model achieved approximately 75% validation accuracy, with particularly strong F1-scores for the Closed and Open classes. The project also helped turn a theoretical understanding of CNNs into a practical computer-vision application.
Another accomplishment was saving the trained model so it can be reused for predictions without having to retrain it from scratch.
What we learned
This project gave me practical experience with the complete machine-learning pipeline, including dataset preparation, image preprocessing, augmentation, CNN architecture, model training, and evaluation.
I also learned why accuracy alone is not enough to evaluate a classification model. Precision, recall, F1-score, and the confusion matrix provide a much better understanding of how the model performs for individual classes.
Most importantly, I learned that building an AI system involves much more than writing a model—it requires understanding the data, identifying weaknesses in the results, and continuously improving the system.
What's next for Driver Drowsiness and Yawn Detection System
The next step is to convert the trained model into a more comprehensive real-time driver safety system.
Future improvements include:
- Real-time webcam-based detection
- Head-pose and driver-distraction detection
- Combining eye closure and yawning into a driver-risk score
- Real-time audio alerts when a high-risk state is detected
- Using larger and more diverse datasets
- Exploring transfer-learning models for improved performance
The ultimate goal is to develop an accessible AI-based driver-monitoring assistant that can identify multiple visual indicators of unsafe driving in real time.
Built With
- ai
- apis
- cloud-services
- cv
- databases
- deeplearning
- frameworks
Log in or sign up for Devpost to join the conversation.