A drowsiness detection system using facial landmarks and hand detection to monitor user alertness.
- Real-time drowsiness detection: Uses facial landmarks for monitoring.
- Head tilt detection
- Yawning detection
- Sound alert: Emits a sound when drowsiness is detected.
- Event logging: Logs drowsiness events with timestamps.
- Data visualization: Plots drowsiness states over time.
- Python 3.12.x
- OpenCV
- NumPy
- Mediapipe
- Pygame
- Matplotlib
- Winsound (for Windows)
- Clone the repository:
git clone https://github.com/CodeRTX/drowsiness-detector.git cd drowsiness-detector
- Install the required packages:
pip install opencv-python numpy mediapipe pygame matplotlib
Alternatively, you can use the provided .whl file
and requirements.txt
for easy installation of modules/packages:
- Create a folder named drowsiness_detector_setup and place the .whl file and requirements.txt inside it.
- Follow the instructions in the
INSTALLATION_GUIDE.txt
provided in theinstallation_files/
folder.
- Run the drowsiness detection script:
python drowsiness_detection_using_deep_learning.py
The system will start monitoring your face for signs of drowsiness.
- Press 's' to save a snapshot of the current frame.
- Press 'Esc' to exit the program.
Below is an image showcasing the drowsiness detection system in action:
drowsiness_detection_using_deep_learning.py
: Main script for drowsiness detection.ringg.mp3
: Ringtone file for sound alert.flowchart.png
: Flowchart of the workflow.logs/events.csv
: Log file for drowsiness events.logs/enhanced_events_plot.png
: Plot of drowsiness states over time.snapshots/snapshot_20241010-165027.jpg
: Example snapshot of facial features.installation_files/
: Directory containing the.whl
,requirements.txt
and theINSTALLATION_GUIDE.txt
files.
There are two known issues with the current system:
- While the hand is covering the face, the 'DROWSY' alert will show up irrespective of whether the person is yawning.
- The system’s working efficiency decreases under low-lighting conditions.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the APACHE 2.0 License.