Prevents sleep deprivation road accidents, by alerting drowsy drivers.
In this project, we have trained a convolutional neural network, to determine whether the eyes are closed or not, further, eye-patches are extracted from the face image to make all predictions. The dataset used for the training process can be accessed from the link given below:
https://www.kaggle.com/kutaykutlu/drowsiness-detection.
Here is the link for a demo video.
$ pip install -r requirements.txt
Then download Eye_patch_extractor_&_GUI.py
, ISHN0619_C3_pic.jpg
, my_model (1).h5
& sleep.jfif
files.
$ streamlit run Eye_patch_extractor_&_GUI.py
According to the survey done by 'The Times of Inidia', nearly 40% of road accidents are caused by sleep deprivation. Fatigued drivers, long-duty driving are the major causes for the same. To solve this issue, this app primarily aims to predict whether or not the driver is sleeping, if found sleeping, it alerts the driver by making a high-frequency sound. This project is to avoid such sleep deprivation accidents!
- A Deep Learning Model will be trained to detect whether the driver's eyelids are open or not. This will be achieved by training a Convolutional Neural Network using Tensorflow.
- A web-cam will take a picture of the driver's face at regular intervals of time and the patch of the driver's eye will be extracted from that picture. This task will be achieved by using OpenCV.
- This patch will be further used for the prediction purpose with the model trained in step 1.
- Using this prediction, if the driver's eyes are closed a beep sound will be played, to alert the driver.
This model is trained with the help of TensorFlow and is based upon convolutional neural networks. It takes RGB images with the dimensions (86 * 86 * 3).
Layer Number | Layer Type | Output Shape | Trainable Parameters | Activation Funtion |
---|---|---|---|---|
1 | CONV2D | (None, 84, 84, 75) | 2,100 | Relu |
2 | MaxPooling2D | (None, 16, 16, 75) | 0 | None |
3 | Conv2D | (None, 15, 15, 64) | 19,264 | Relu |
4 | MaxPooling2D | (None, 7, 7, 64) | 0 | None |
5 | Conv2D | (None, 5, 5, 128) | 73,856 | Relu |
6 | MaxPooling2D | (None, 2, 2, 128) | 0 | None |
7 | Flattern | (None, 512) | 0 | None |
8 | Dense | (None, 64) | 32,832 | Sigmoid |
9 | Dense | (None, 2) | 130 | Softmax |
This model uses OpenCV's "Haar Cascade Classifier" for face detection and after the proposal of the region of interest, it extracts the eye patch by the "Centroid Method" developed by us. These extracted features will be then passed to the trained model for Drowsiness Detection.