Road accidents resulting from driver drowsiness pose a significant threat to public safety, leading to a substantial loss of lives worldwide. Detection of drowsiness and providing appropriate alerts can play a pivotal role in preventing these accidents.
A Multi-Tasking Convolutional neural network (CNN) is used, which extracts eye features to accurately identify the onset of drowsiness. By extracting facial features using the Haar cascade classifier, we feed the obtained data into a transfer learning model (InceptionV3) which detects drowsiness accurately.
EAR is a mathematical formula for calculating the eye closing and opening state. Strating at the left-hand side and going clockwise the points are labelled from P1 to P6. With |P2- P6|+|P3-P5| in the numerator and |P1-P6| in the denominator. If the ratio is close to 0, this means that the eye is closed and open if the value is slightly above 0. By setting a threshold value, if the value is lower than the threshold, then eye is labelled as closed and if above the threshold its labelled as open. In this case it will also be labeled as closed which will in turn be inferred as drowsy, but that should not be the case. This edge condition can be solved by setting a threshold time. If the eye is closed for a time exceeding threshold only then it should be set as drowsy.
MRL eye datset has been used to train the model. The dataset consists of 84,898 images consisting of both drowsy and non drowsy images with different lighting conditions, to make the model versatile. The dataset can be downloaded from here: http://mrl.cs.vsb.cz/eyedataset
The model was trained for 9 epochs and attained a test accuracy of 93%. More epochs can be ran to train the model furthermore and achieve a better accuracy.
If the eye is closed for a substantial amount of time, an alarm sound is produced alerting the driver.