Posture and Drowsiness Monitoring Model
Road accident is a global tragedy with number of cases increasing year by year. Owing to the bad infrastructure and dangerous driving habits, Most deaths around 105,000 per year occur in India. Around 20 percent of traffic accidents and up to 25 percent of serious accidents occur because of Driver’s diminished vigilance. The increasing number of accidents due to a drivers vigilance level diminishing has become a grave problem for us. To help tackle this problem we have developed two models named Posture and Drowsiness Monitoring that will aid the drivers once deployed on vehicles.
Scope
- For Drowsiness Monitoring Model, The algorithm is coded on OpenCV platform. The parameters considered to detect drowsiness are face and eye detection, blinking, eye closure and head tilt. The algorithm is Haar trained to detect the face. Once the face is detected, the facial landmarks position around the eyes is determined. The mean eye landmarks distance is calculated and thus the eye state is determined from that distance. Eyelid closure/blink/gaze is detected using the values obtained from each of the incoming frames. Facial region is detected by Viola Jones Algorithm. Main emphasis is paid to processing of data and faster detection. Drowsiness of the driver will be found by finding whether the eyes are shut over subsequent frames and similarly it can be found if the driver is yawning by observing the mouth region. Yawning and closing of eyes may suggest that the driver is drowsy and hence sound the alarm.
- For Posture Monitoring Model, It uses live camera feed to check if the position of your head is within the defined boundary. If your head is outside the boundary, then warning sound is played. The sound is stopped only after your head is brought inside the boundary. Live webcam feed is taken and passes through PoseNet model. More information can be obtained here.
- PoseNet model returns the coordinates of eyes, nose and ears. These coordinates are used to get the position of the face and establish boundaries for correct posture. If the head moves out of the established boundary an alarm sound is played until the head is brought back within the boundary. The size of the boundary can be adjusted in the settings menu
Algorithms
For Drowsiness Monitoring Model, we have used following methods
- Face detection
https://towardsdatascience.com/face-detection-with-haar-cascade-727f68dafd08/
2. Eye detection
https://docs.opencv.org/4.5.2/db/d28/tutorial_cascade_classifier.html/
3. EAR (Eye Aspect Ratio)
https://www.hindawi.com/journals/cmmm/2020/1038906/
4. Blink detection
https://www.pyimagesearch.com/2017/04/24/eye-blink-detection-opencv-python-dlib/
5. MAR (Mouth Aspect Ratio)
https://www.irjet.net/archives/V7/i6/IRJET-V7I699.pdf/
For Posture Monitoring Model, we have used following methods
- PoseNet
Tools & Technology
Software Requirements:
- Python
- Libraries
✓ Numpy
✓ Scipy
✓ Playsound
✓ Dlib
✓ Imutils
✓ Opencv
✓ Pytorch
✓ Tkinte
Operating System:
Windows 10 2.1
Hardware Requirements:
- Laptop with basic hardware
- Webcam
Flowchart
Drowsiness Monitoring Model
Posture Detection Model
Outputs
Conclusion
we developed a GUI based application that monitors posture of a driver and detects whether a driver is in drowsiness state.
If the driver is found in any of the above two states a alarm would be sounded thereby alerting the driver and his/her co-passengers thus aiding to prevent road accidents.
We successfully implemented the above two models using OpenCV, dlib, Pytorch and Tkinter giving accurate results once deployed.
For Implementation
use following links for references