Development of Real-time Drowsiness Detection System using PythonGautam KumarBlockedUnblockFollowFollowingApr 22Figure 1: Drowsiness detection systemRoad accidents are nowadays very common.
In India, on average about 1214 crashes happen on a daily basis.
There are various reasons that can cause road accidents such as reckless driving, speeding, drunk driving, etc.
Among these night driving is also a major reason for car accidents.
Apart from the potholes and non-functional street lights, continuous driving for several hours makes commuting during night riskier.
Due to continuous journey, tiredness and fatigue can easily arise in drivers which may result in critical road accidents.
From the survey, it is seen that almost 20% accident is caused by fatigue and 50% of accidents happened on road .
A solution to this problem is to identify when the driver is falling asleep and alarming the passengers of the situation so that appropriate measures can be taken.
From incoming live video stream, a frame is extracted for processing.
Then Histogram Oriented Gradient (HOG) algorithm is applied to that frame to extract dense feature from the image.
The advantage of HOG algorithm is that it can extract all features from a region of interest (ROI) irrespective to local features extraction algorithm such as LBP, SIFT.
HOG algorithm captures the shape of the object by dividing an image into small size of blocks such as 8 x 8 or 4 x 4.
The facial landmarks feature extracted from the frontal face image using HOG algorithm is shown in Figure 2.
For drowsiness detection we need only eye region, therefore only eye landmark features are extracted from whole facial features.
Figure 3 represents the data flow diagram (DFD) of the system.
Figure 2: Landmark feature of a face imageFigure 3: DFD of drowsiness detection systemAfter extracting eye landmark features from face image (as shown in Figure 2) algorithm calculates co-ordinate of left and right eye.
An eye aspect ration (EAR) is calculated using Euclidean distance.
EAR is the ratio of the maximum horizontal length to the maximum vertical length of the eyes.
Based on the threshold, the system raise alarm is it detects drowsiness.
Figure 4,5 and 6 shows the alarm status of the system when driver is awake, blinks an eye and when closes an eye to sleep.
Figure 4: When a driver is awakeFigure 5: When a driver blinks eyes.
Figure 6: When a driver closes the eye to sleep.
Video shows real-time drowsiness detection using a webcam, Bandicam is used to record desktop activity.
Please use a headphone to hear the alarm.
FUTURE WORKIn last decades many researchers worked on drowsiness detection and got significant success.
However, still, research is going on in this field to make the system more reliable.
There are some challenges with this application.
For example, if a driver is wearing spectacles, having a partial face that can not be seen by a camera or sensor.
1) For future work, we will extend our application to detect drowsiness even when the subject is using sunglass or color spectacles.
Another future study can be done to detect drowsiness is to develop a system which can detect drowsiness in the night or with very low illumination.
2) Real-time data are always unconstrained and with unconstrained nature of the subject/driver, it becomes very difficult to find facial landmarks.
Therefore, to overcome this constraint a more reliable application can be developed which can detect face even when user/subject is not friendly.
3) To increase the sensitivity of application, a multimodal system can be developed which not uses only eye feature, but also facial expression, mouth feature and combine all features to make the decision where driver/subject is sleeping or not.
Thanks to Jayeeta Chakraborty who helped me to develop this model and Adrian Rosebrock for excellent tutorials.
You can find the source code at my GitHub repository.
 Driver Fatuigue and Road Accidents A literature Review and Position Paper, Royal Society for the Prevention of Accidents.
February 2001.. More details