Detecting Driver Drowsiness using Behavioral measures and Representation learning: A Deep Learning-based Technique
- Project Description
- Configuration Instructions
- Installation Instructions
- Operating Instructions
- Manifesting Directory structure
- Contact
- References
The inclining in road accidents is one of the most prevailing problems around the world. The growing number of vehicles on the road has paved a way for many inefficient and inattentive drivers. The key to safe driving and prevention of accidents is predominantly dependent on the driver. Preventing accidents by drowsiness need a technique to detect the factors that cause sleepiness in driver. Drowsiness or sleepiness is a biological state where the body is in transition from an awake state to a sleeping state in which the level of consciousness is reduced due to lack of sleep or fatigue, this causes the driver to fall into sleep quietly. During this stage, a driver is unable to take control of the vehicle and loses consciousness.
According to statistics from the US NHTSA out of 1,00,000 accidents reported annually, 76,000 crashes are due to drowsiness. In Australia, about 6% of accidents happen due to drowsiness and UK reports approximately 20% of the accidents by fatigue. These statistics infer the importance of a drowsiness detection system is unavoidable and motivated to build a detection system as a precautionary measure to avoid road accidents. A common solution to the drowsiness detection problem is to develop a model that detects the sleepiness in drivers in an early stage to prevent accidents by considering several common signs and alert the driver if any of the signs are frequently detected. This project proposes to develop a robust model to detect the sleepiness in drivers by capturing behavior-based images such as yawning, eye blinking, and head-nodding states.
The Project requires the following tools and libraries to run the source code.
-
GPU based CUDA®-enabled card (Ubuntu and Windows)
-
- Python version 3.6.0 – 3.9.0
- pip 19.0 or later
- Ubuntu 16.04 or later (64-bit)
- macOS 10.12.6 (Sierra) or later (64-bit)
- Windows 7 or later (64-bit)
-
Python IDE (to run ".py" file)
-
Installs tensorflow in virtual environment using pip:
pip install --upgrade tensorflowTo check your tensorflow installation:
python -m pip show tensorflow # to see which version and where tensorflow is installed -
Numpy releases are available as wheel packages for macOS, Windows and Linux on PyPI.
Install numpy using pip:
pip install numpyInstall numpy using Conda packages:
conda install numpyTo check your numpy installation:
python -m pip show numpy # to see which version and where numpy is installed -
Install scikit-learn using pip:
pip install -U scikit-learnTo check your scikit-learn installation:
python -m pip show scikit-learn # to see which version and where scikit-learn is installed -
OpenCv releases are available as wheel packages for macOS, Windows and Linux on PyPI.
Install OpenCv using pip:
pip install opencvInstall OpenCV using Conda packages:
conda install opencvTo check your installation:
python -m pip show opencv # to see which version and where opencv is installed -
Matplotlib releases are available as wheel packages for macOS, Windows and Linux on PyPI.
Install it using pip:
python -m pip install -U pip python -m pip install -U matplotlibInstall it using Conda packages:
conda install matplotlib
To work with the project code
-
Clone the Driver_Drowsiness_Detection repository into your local machine from this link : https://github.com/sowmi06/Driver_Drowsiness_Detection.git
-
Follow the same directory structure from the cloned repository.
The following are the steps to replicate the exact results acquired from the project:
- Satisify all the system and the tool, libraries requirements.
- Clone the Driver_Drowsiness_Detection repository into your local machine.
- Run the Drowsiness_Detection.py in a python IDE to get the final output
- Follow the same directory structure from the cloned repository.
The following directory structure is required to replicate exact results acquired from the project:
.
├── Cascade_Classifier
│ ├── haarcascade_eye.xml
| └── haarcascade_frontalface_default.xml
|
├── Dataset
│ ├── Eyes
| | ├── Close_eye
| | | └── ... # raw images
| | └── Open_eye
| | └── ... # raw images
│ └── Face
| ├── no_yawn
| | └── ... # raw images
| └── yawn
| └── ... # raw images
|
├── Source_Code
│ ├── Drowsiness_Detection.py
│ └── face_eye_detector.py
|
├── LICENSE
└── README.md
Cascade_Classifier - A folder containing Haar-Cascade Classifier ".xml" files from official OpenCV repository.
haarcascade_eye.xml - A ".xml" file to detect the eyes from image.
haarcascade_frontalface_default.xml- A ".xml" file to detect the faces from image.
Dataset - A folder with two sub folders containing Eyes and Faces raw images.
Eyes - A sub-folder containing raw images of open and close eye.
Face - A sub-folder containing raw images of yawn and no yawn.
Source_Code - A folder containing source code to execude the output.
Drowsiness_Detection.py - A ".py" file containing the proposed model implementation of the drowsiness detection system.
face_eye_detector.py - A ".py" file containing face detector and preprocessing steps.
Readme.md - Readme file to execute the project.
Feel free to drop an email for any help.
- Anaconda Navigator : https://docs.anaconda.com/anaconda/navigator/install/
- PyCharm IDE Installation : https://www.jetbrains.com/pycharm/download/#section=windows
- Spyder IDE Installation : https://www.psych.mcgill.ca/labs/mogillab/anaconda2/lib/python2.7/site-packages/spyder/doc/installation.html
- VS code IDE Installation: https://code.visualstudio.com/download
- Tensorflow Installation : https://www.tensorflow.org/install/pip#virtual-environment-install
- Numpy Installation : https://numpy.org/install/
- Scikit learn Installation : https://scikit-learn.org/stable/install.html
- OpenCv Installation : https://pypi.org/project/opencv-python/
- Mathplotlib Installation: https://pypi.org/project/matplotlib/
- Haar cascade classifier souce files: https://github.com/opencv
