This project is a Driver Monitoring System that detects drowsiness and mobile phone usage using YOLOv8, OpenCV, and Dlib. The system continuously monitors the driver's facial expressions and actions to ensure road safety.
- Drowsiness Detection: Uses EAR (Eye Aspect Ratio) and MAR (Mouth Aspect Ratio) to detect if the driver's eyes are closed or mouth is open for a prolonged period.
- Phone Usage Detection: Identifies if the driver is using a mobile phone while driving.
- Head Tilt Detection: Determines if the driver's head is tilted abnormally.
- Alarm System: Triggers an alert when drowsiness or phone usage is detected.
- Database Integration: Sends drowsiness and phone usage events to a MySQL server via a Node.js backend using Axios.
- Capture real-time video frames using OpenCV.
- Detect face and facial landmarks using Dlib.
- Analyze EAR and MAR values to determine drowsiness.
- Detect phone usage using YOLOv8 object detection.
- If drowsiness or phone usage is detected:
- Start a timer and send the event to the server with a timestamp.
- If the condition stops, record the end time and send the event duration to the server.
- Repeat this process frame-by-frame for continuous monitoring.
- Python: Main programming language.
- OpenCV: Image processing and video frame handling.
- Dlib: Facial landmark detection.
- YOLOv8: Object detection for mobile phone usage.
Ensure you have the following installed:
- Python
pip install -r requirements.txt
- Start the Python script:
python driver_monitor.py
- Ensure the Node.js server is running to handle database communication.
[Camera] -> [OpenCV & Dlib] -> [YOLOv8 Detection] -> [Condition Check] -> [Send Data to Backend] -> [MySQL Database]
- Implement Real-time Dashboard for monitoring multiple drivers.
- Improve model accuracy using custom YOLOv8 training.
- Deploy as an Edge AI solution for in-vehicle devices.