Drowsiness Detection System
In our daily routine a number of person are driving vehicles. Car driver, taxi driver, bus driver, truck driver, etc. those all drivers travelling for long distance journey then there are chances of lack of sleep. It became very hazardous to drive when they are feeling very sleepy.
Many accidents are caused by high speed, rough driving, talking on phone while driving etc. One of the reason of accidents occurs due to drowsiness and to avoid this situation I have made a system by using Python, OpenCV and Keras which will give alert sound whenever driver feels drowsy .So applying drowsiness detection system in the vehicles, driver can have an alert sound if he/she is felling sleepy and there will be less chances of accidents and lot of lives will be saved.
Objective
The main objective of this intermediate Python project is to construct drowsiness detection system that will record if driver is feeling drowsy and if driver tries to take a nap then he/she will have to face a alarm sound till the webcam founds the diver’s eyes open more then a few seconds and he/she can be alert and can focus on driving.
About the intermediate Project:
I have made this project by applying OpenCV which can be used for collecting multiple images by webcam and add them into Deep learning model which will identify either a person’s eyes are closed or open.
This python project is divided into five different parts which are given below :
- Webcam have a continuous look at driver’s eyes.
- Record those images and create Region Of Interest(ROI).
- It detect the eyes from ROI and feed it into the classifier.
- Classifier will identify either the eyes of the driver are open or closed.
- It then calculates the score and detect that whether the driver is feeling drowsy or sleepy.
Conditions
The requirement of this Python Project is a webcam through which we can capture images of the driver. first of all we should have installed python (3.6 or above version) and then using pip, Below described packages are compulsory to be installed in our detection system.
OpenCV :- It is used to detect face and eyes.
pip install OpenCV-python
TensorFlow :- It is used to tensorflow as backend.
pip install tensorflow
Keras :- It is used to build classification model.
pip install keras
Pygame :- It is used to play alarm sound.
pip install pygame
- This “model.py” file contain the program through which we can built our classification model. In this file we can see implementation of convolution neural network.
- “Drowsiness detection.py” is the main file of the Project. We have to run this file to detect our system.
- “alarm.wav” audio clip which gave alert when driver feels sleepy.
- This “models” folder carry model file “cnnCat2.h5” which was trained on convolution neural network.
- This “ haar cascade files” folders consists of the xml files that are required to detect the objects from the image .In our system ,we are detecting the face and eyes of the person from the image.
Output
Purpose
The main purpose of making this detecting project is to make our world accident free due to drowsiness and due to human carelessness. And once this project come to an act then the number of roadways accidents will be reduced and human lives will be saved.
My GitHub repository link and project code
“ Do not wait for things to happen — make them happen.”
— Sadhguru