https://github.com/codertx/drowsiness-detector
A drowsiness detection system using facial landmarks and hand detection to monitor user alertness.
https://github.com/codertx/drowsiness-detector
cv2-library facial-landmarks matplotlib mediapipe myenv protobuf pygame sdl winsound xnnpack
Last synced: about 1 month ago
JSON representation
A drowsiness detection system using facial landmarks and hand detection to monitor user alertness.
- Host: GitHub
- URL: https://github.com/codertx/drowsiness-detector
- Owner: CodeRTX
- License: apache-2.0
- Created: 2024-10-12T18:26:27.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-03-28T21:04:21.000Z (about 1 month ago)
- Last Synced: 2025-03-28T22:22:04.324Z (about 1 month ago)
- Topics: cv2-library, facial-landmarks, matplotlib, mediapipe, myenv, protobuf, pygame, sdl, winsound, xnnpack
- Language: Python
- Homepage:
- Size: 454 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Drowsiness Detector
A drowsiness detection system using facial landmarks and hand detection to monitor user alertness.
## Features
- **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.## Requirements
- Python 3.12.x
- OpenCV
- NumPy
- Mediapipe
- Pygame
- Matplotlib
- Winsound (for Windows)## Installation
### Standard Installation
1. Clone the repository:
```sh
git clone https://github.com/CodeRTX/drowsiness-detector.git
cd drowsiness-detector
```
2. Install the required packages:
```sh
pip install opencv-python numpy mediapipe pygame matplotlib
```### Alternative Installation Using Pre-built Dependencies
Alternatively, you can use the provided `.whl file` and `requirements.txt` for easy installation of modules/packages:
1. Create a folder named drowsiness_detector_setup and place the .whl file and requirements.txt inside it.
2. Follow the instructions in the `INSTALLATION_GUIDE.txt` provided in the `installation_files/` folder.## Usage
* Run the drowsiness detection script:
```sh
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.## Real-time Demonstration
Below is an image showcasing the drowsiness detection system in action:

## Files
* `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 the `INSTALLATION_GUIDE.txt` files.## Limitations
There are two known issues with the current system:
1. While the hand is covering the face, the 'DROWSY' alert will show up irrespective of whether the person is yawning.
2. The system’s working efficiency decreases under low-lighting conditions.## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
## License
This project is licensed under the APACHE 2.0 License.