A Python-based computer vision project that detects drowsiness using facial landmarks.
This project uses OpenCV, dlib, and other libraries to create a real-time drowsiness detection alert system. It analyzes facial landmarks to determine if the eyes are closed. If the eyes are closed, the user will be alerted.
- Real-time facial landmark detection.
- Eyes closed detection using the Eye Aspect Ratio (EAR) formula.
- Drowsiness alert with visual and auditory feedback.
- Python 3.x
- Install dependencies with
pip install -r requirements.txt
-
Clone the repository:
git clone https://github.com/your-username/drowsiness-alert.git cd drowsiness-detection-alert
-
Run the main script:
python main.py
-
Feel free to test the drowsiness detection alert system.
- OpenCV
- dlib
- scipy
- pygame
pip install -r requirements.txt
- The facial landmarks predictor model is provided by dlib.
The drowsiness detection alert system provides several configuration options that users can adjust to customize the behavior of the alert system. These options include:
EAR_THRESHOLD
: The threshold for detecting closed eyes.ALERT_DURATION
: The duration (in seconds) for triggering the drowsiness detection alert.
To configure these options, users can modify the corresponding constants in the main.py
script.
If you encounter issues while running the drowsiness deetection alert system, consider the following troubleshooting steps:
-
Issue: Eyes not detected
- Solution: Ensure proper lighting conditions and adjust the camera angle for better detection.
-
Issue: False positives
- Solution: Tweak the
EAR_THRESHOLD
constant in themain.py
script to fine-tune the sensitivity.
- Solution: Tweak the
Feel free to contribute to this project.
This project is licensed under the MIT License.