Inspiration
The inspiration for Drowsy-Guard came from the sobering reality of fatigue-related accidents. Whether it’s a student pulling an all-nighter or a driver on a long stretch of highway, a few seconds of "micro-sleep" can be life-altering. We wanted to build an accessible, software-based safety net that uses the hardware people already own—a simple webcam—to provide real-time protection against drowsiness and lapses in focus.
What it does
Drowsy-Guard acts as an intelligent monitor that tracks a user’s eye activity in real-time. By analyzing facial landmarks, the system detects when a user’s eyes have been closed for a duration that exceeds a normal blink. Once it identifies potential drowsiness, it immediately triggers an audio alert to wake the user and bring their attention back to the task at hand.
How we built it
We developed the project using Python as the core language, leveraging OpenCV for video stream processing and Dlib for high-accuracy facial landmark detection. The technical "brain" of the project is the Eye Aspect Ratio (EAR) calculation. We mapped 6 specific coordinates around each eye to calculate the ratio of the eye's height to its width using the formula: $$ EAR = {||p2 - p6|| + ||p3 - p5||}/{2||p1 - p4||} $$. If the EAR value drops below a calibrated threshold of 0.25 and stays there for a set number of consecutive frames, the system identifies it as sleep rather than a blink and sounds the alarm.
Challenges we ran into
We faced significant hurdles with environmental variables, specifically varying lighting conditions. In low-light settings, the landmark predictor would often lose track of the eyes, which we solved by implementing image preprocessing techniques like grayscale conversion and histogram equalization. Distinguishing between a long blink and actual drowsiness was also tricky; we had to fine-tune the frame-counter logic to ensure the alarm only sounds when the eyes are closed for more than a specific duration, reducing false positives.
Accomplishments that we're proud of
We are proud of achieving a high level of accuracy across different face shapes and lighting environments. We successfully optimized the code to ensure low latency, meaning the alarm sounds almost instantly when the eyes close—a critical requirement for any safety-first application. We are also proud of the project’s simplicity, as it makes life-saving technology accessible using nothing more than a standard laptop camera and open-source libraries.
What we learned
This project was a deep dive into Computer Vision and Digital Signal Processing. We learned how to translate biological movements into mathematical data points that a machine can interpret. We also gained significant experience in managing real-time data streams and learned the importance of "fail-safe" logic when building tools designed for human safety.
What's next for Drowsy-Guard
Moving forward, we plan to expand Drowsy-Guard by porting the logic to a mobile application for use on car dashboards. We also aim to integrate yawn detection by tracking mouth landmarks to detect early signs of fatigue before the eyes even close. Finally, we want to implement personalized threshold calibration so the AI can adapt to each user's unique facial features and blinking patterns.
Log in or sign up for Devpost to join the conversation.