🚗 Inspiration Fatigue-related accidents have claimed thousands of lives globally. Long hours behind the wheel, lack of sleep, and monotony are silent killers — especially among truck drivers and night commuters. We were deeply moved by the idea of using AI and computer vision to detect early signs of drowsiness and prevent accidents before they happen. That's how DrowsyGuard was born — a real-time alert system for drowsiness and distraction detection using cutting-edge AI.

😴 What it does DrowsyGuard is an AI-powered system that:

Detects eye closure duration and yawning frequency using a webcam.

Uses Eye Aspect Ratio (EAR) and Mouth Aspect Ratio (MAR) to identify early signs of drowsiness.

Combines traditional image processing with a CNN deep learning model to ensure accuracy.

Triggers a voice alert using TTS if signs of drowsiness are detected.

Displays everything on a clean React-based web dashboard.

(In future) Will be integrated into a Raspberry Pi for real-world vehicle installation.

🛠️ How we built it Backend:

Built with Flask, using OpenCV and Dlib for facial landmarks.

EAR & MAR calculations to detect blinking and yawning.

A custom Convolutional Neural Network (CNN) trained on a dataset of open/closed eyes for added precision.

Real-time camera input processing.

Voice alerts via pyttsx3 for immediate feedback.

Frontend:

Created using React.js with an intuitive and responsive UI.

Trigger-based interaction with Flask backend.

Displays alerts and updates live.

Model Training:

Eye state classification CNN model was trained using preprocessed images (resized to 100x100).

Model trained using TensorFlow & Keras.

Saved and integrated into backend for real-time prediction.

Tools/Tech Stack:

Python, Flask, TensorFlow, OpenCV, Dlib

React.js, HTML, CSS

Git, GitHub

VS Code

Local and cloud testing (Google Colab + localhost)

⚠️ Challenges we ran into Real-time performance bottlenecks when combining CNN with video frames.

Integrating Flask backend with a React frontend cleanly.

Shape mismatch errors while feeding grayscale vs RGB images into the CNN.

Installing dependencies like Dlib across platforms.

Simultaneous use of deep learning and classical image processing required smart orchestration.

🏆 Accomplishments that we're proud of Achieved accurate drowsiness detection using both EAR/MAR and CNN-based prediction.

Created a complete full-stack web-based solution with frontend + backend.

Maintained real-time detection with smooth performance.

Designed a system ready for hardware-level deployment.

Entire project packaged and deployed successfully within a hackathon timeframe!

📚 What we learned Real-world AI integration needs more than just a working model — it requires thoughtful system design.

Frontend-backend syncing in real time takes effort and smart state management.

Using multiple detection methods (CNN + EAR/MAR) gives stronger results.

Hardware deployment (like Raspberry Pi) requires lightweight and optimized models.

🔮 What's next for AI-powered drowsiness detector Raspberry Pi Integration: Deploy the system in vehicles for real-world use.

IoT Features: Add a buzzer or haptic feedback via Arduino when drowsiness is detected.

Cloud Dashboard: Live data syncing and remote monitoring for fleet vehicles.

Voice AI Assistant: Guide drowsy drivers with encouraging messages using TTS.

Distraction Detection: Add head pose estimation to detect if the driver is looking away from the road.

Mobile App Companion: Let users connect to the in-car camera system via their phones.

Built With

Share this project:

Updates

Submission history