A deep learning model built with Keras that checks for drowsiness in a driver and rings an alarm if it crosses a (configureable) threshold. As of now, it only takes into account the state of the eyes. However, using the state of the mouth is also a viable option.
-
Download this folder. And store all the files in Models directory within your project.
-
Creating the environment
conda env create -f environment.yml
conda activate ddd
- Running the code
python main.py
-
Locate faces in videos. This can be done in a single step with something like builtin detector of OpenCV which uses Single Shot Detector. Alternatives include using YOLO, Faster RCNN etc. However, SSD is found to have a nice balance of accuracy and speed.
-
Feed the bounding box of face into a facial landmark detector. A pretrained landmark finder is located in dlib. There are two options regarding this, the 68 point complete detector or the 5 point smaller detector. The 5-point cannot be used to find bounding boxes of eyes so 68 is used is here.
-
After finding landmarks like eye, mouth, we need to feed them into a classifier. Dataset was obtained from here. We used the one with only eye patches.
Dataset was obtained from here. We used the one with only eye patches. The lack of data, and the lack of variety in it caused some problems in wild detection.
The model achieved substantial accuracy on the dataset but as noted above, in the wild detection proved to be more challenging due to lack of data, and lack of variety in data.