Drowsiness Detector Python model to detect the drowsiness of the Driver.
This model has following key steps: - It detects the human face for the live vedio by processing each frame. - Then with the help of dlib library of python and a dataset file we get the location of points on the face. - After this it calculates the eye aspect ratio to get how much the eye of the person is open. - This process continues till the aspect ratio is smaller than a desired one for particular frames. - On encountering above condition the alert is raised
Pyhton3
installed with following libraries on your system.
scipy
to compute the Euclidean distance between facial landmark points in the eye aspect ratio.Install
with following commandpip install scipy
imutils
for vedio and image processingInstall
with following commandpip install imutils
thread
for playing alert without intrupting or pausing the scriptInstall
with following commandpip install threaded
playsound
for playing alertInstall
with following commandpip install playsound
dlib
most important of all for returning the facial pointsInstall
with following commandpip install dlib
and make sure you have cmake installed.
cv2
andnumpy
for computer vision on imagesInstall
with following commandpip install opencv-python
andpip install numpy
After the installation of all packages run with the following command
python detect_drowsiness.py \--shape-predictor face_shape_predictor.dat \--alarm alert.wav
This project was by me to detect drowsiness in drivers and raise a appropriate alert so as to minimise road accidents due to drowsiness.