A real-time drowsiness detection system that monitors driver alertness using computer vision and machine learning techniques.
- Real-time face detection and eye tracking
- Drowsiness detection using Eye Aspect Ratio (EAR)
- Facial emotion recognition
- Customizable alert thresholds
- Audio alerts for drowsiness detection
- Interactive web interface using Streamlit
- Real-time statistics display
- Python 3.7+
- OpenCV
- dlib
- streamlit
- pygame
- numpy
- imutils
- scipy
- facial_emotion_recognition
- Clone the repository:
git clone https://github.com/kishore0-0-7/drowsy-detection.git
cd drowsy-detection- Install dependencies:
pip install -r requirements.txt- Download required models:
- Download
shape_predictor_68_face_landmarks.datfrom dlib - Ensure
alarm.wavis in the root directory - Download emotion recognition models (
fer.jsonandfer.h5)
- Run the Streamlit app:
streamlit run streamlit_app.py- Adjust settings in the sidebar:
- EAR Threshold: Controls sensitivity of eye closure detection
- Number of Frames: Consecutive frames for drowsiness detection
- Time Threshold: Duration before triggering alert
- Click "Start Detection" to begin monitoring
- Press "Stop" to end the session
- Uses facial landmarks to detect eye positions
- Calculates Eye Aspect Ratio (EAR)
- Triggers alert when EAR falls below threshold for specified duration
- Detects facial expressions in real-time
- Classifies emotions into categories:
- Angry
- Disgust
- Fear
- Happy
- Sad
- Surprise
- Neutral
-
Main Application (
streamlit_app.py)- Web interface
- Real-time video processing
- Alert system
- Statistics display
-
Emotion Detection (
emotion.py)- Facial emotion recognition
- Expression classification
- Real-time emotion tracking
This system is intended as an auxiliary tool and should not be relied upon as the sole means of preventing drowsy driving. Always ensure proper rest before operating vehicles.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.