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.
scipyto compute the Euclidean distance between facial landmark points in the eye aspect ratio.Installwith following commandpip install scipy
imutilsfor vedio and image processingInstallwith following commandpip install imutils
threadfor playing alert without intrupting or pausing the scriptInstallwith following commandpip install threaded
playsoundfor playing alertInstallwith following commandpip install playsound
dlibmost important of all for returning the facial pointsInstallwith following commandpip install dliband make sure you have cmake installed.
cv2andnumpyfor computer vision on imagesInstallwith following commandpip install opencv-pythonandpip 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.