Driver Drowsiness detection using Python

This is a python project which will enable us to detect the drowsiness of the driver while he/she is driving a vehicle. The driver expressions are detected and then the dataset is compared to give the desired output on a particular scale. There are a lot of drivers and they all feel lazy or sleepy some times which could lead to fatal accidents. To reduce these accidents, a system should be developed which can identify the expressions of the driver and then alert the person in advance. This could save a lot of lives. This project will be helpful in that case.

Read more..

Project implementation

Drowsiness detection is not easy by the system as the computer is not smart enough. But with proper programming and datasets, we can create an application which can at least give the result to some accuracy. We will be using the OpenCV to include the images of the laziness or drowsiness expressions. The dataset will compare the captured images and then give the result. Deep learning is required to classify between eye-open and eye-closed.

Latest projects on Python

Want to develop practical skills on Python? Checkout our latest projects and start learning for free

  • First, the image will be captured by a camera installed in front of the driver.
  • A region of interest is created where the expressions of the face are read.
  • In the region, eyes are especially detected for the drowsiness.
  • Classify the eye into either open or closed.
  • The time duration of the eye closed is calculated to predict the drowsiness of the driver.

Around 7000 images of drives are collected in the dataset to let the developer compare the values easily. For this project, we will use the CNN (Convolution Neural Network) which will provide a backbone for the project. The CNN basically consists of an input layer and many hidden layers which facilitates different functions. There will be a need of including a lot of database files which are OpenCV, TensorFlow, Keras, and Pygame. 

The method cv2.VideoCapture (0) to access the camera, it will facilitate the project to capture the photos and save it. Now () will then read the file and store it in a frame variable. The classifier cv2.CascadeClassifier () is used to classify the photos in either eye open or closed. The CNN classifier will categorize the photos into different groups. The score is also calculated for the face of how much the driver is drowsy. To print the result we will use the cv2. PutText () which will display the real-time status of the person. The source code and data files are available for free on the internet. It can be easily obtainable and useable.


This python project developed is very useful in detecting face expressions. Hence it gives us a point of understanding in the field of deep learning. The system works on the CNN which again is a machine learning concept. The developer will need good knowledge over python programming language, machine learning, and data analytics. This project can be made by the student as their first machine learning topic.

How to build Python projects Did you know

Skyfi Labs helps students learn practical skills by building real-world projects.

You can enrol with friends and receive kits at your doorstep

You can learn from experts, build working projects, showcase skills to the world and grab the best jobs.
Get started today!

Kit required to develop Driver Drowsiness detection using Python:
Technologies you will learn by working on Driver Drowsiness detection using Python:
Driver Drowsiness detection using Python
Skyfi Labs Last Updated: 2021-05-28

Join 250,000+ students from 36+ countries & develop practical skills by building projects

Get kits shipped in 24 hours. Build using online tutorials.

More Project Ideas on Python

Face recognition using Raspberry Pi
Linux Based Medication remainder
Ultrasonic beats player
Automated door opener with lighting control
IoT based theft detection using Raspberry Pi
Wheelchair wih safety system
Raspberry Pi osilloscope
Health monitoring using Raspberry pi
Automatic Green house system
Wheel combined robotic suspension system
Bank Account Management System using SQL and C++
Content Aggregation Project using Python
URL Shortener
Develop An Expense Tracking System using Python
Mp3 Player using Python
Simple Chat room using Python
Folder sorter according to files extensions using Python
Batch Image editor using Python
Password Generator and Manager using Python
Web Scrapper (Amazon Price Tracker)
Bird Species detection using Python
Develop An Online CV Builder using Python
Online Job Portal using Python and SQL database
Social Media Site using Python (Django)
Driver Drowsiness detection using Python
Traffic recognition using python
Website Blocker using python
Speech Emotion Recognition using Python
Speed Typing test with Python
Gender and Age Detection using Python
Pharmacy management using Python
Virtual Notebook - Python project
Find My Professor
How to Develop a TIC TAC TOE game using Python
Admission tracking system
Assignment submission system using Python
Smart feedback system using Python
Data collection tool using Python
Language translator and converter using Python
Automatic Brand LOGO detection using Python
Rock, paper, scissor game using python
Youtube video downloader with Tkinter UI python project
Instagram bot using python
Desktop notifier app using python
Spotify song downloader using python
Jarvis Personal assistant using Python
Sound processing python project
Develop a Supermarket Billing System with Python
Desktop voice assistant project

Subscribe to receive more project ideas

Stay up-to-date and build projects on latest technologies