Drowsiness (Sleep) Detection Using Machine Learning – Part 1 of 5

 Drowsiness (Sleep) Detection Using Machine Learning – Part 1 of 5


Machine learning, a highly used word of any programmer, or a researcher in this cyber world. This is a system with an automated ability of learning and improving from experiences with a special program of Artificial Intelligence(AI). As a sub-area of AI, this term refers the ability of IT systems to find solutions independently. Therefore, this lies on the base of experience. There are two main types of machine learning algorithm types as supervised and unsupervised. But there are semi-supervised machine learning and reinforcement machine learning as well. Machine learning provides to analyze a huge amount of data. When developing a model with machine learning, the results may take time, because it may require additional time to train the gathered data and come up with a more accurate result. But the combination of AI and cognitive technologies can make the processing more effective.

When it comes to machine learning models in these days, people are coming up with new ideas that can be developed through a simple code and an online dataset. But developing a machine learning model for a real-world scenario is not much easy. Under “computer vision” technology, Face detection is so popular. It is the process in which algorithms are developed and trained to properly locate faces or objects (in object detection, a related system), in images. These can be in real-time from a video camera or photographs. An example where this technology is used is in airport security systems. The camera software must first detect, and identify the features before making identification to recognize a face. Likewise, when Facebook makes tagging suggestions to identify people in photos it must first locate the face. On social media apps like Snapchat, face detection is required to augment reality which allows users to virtually wear dog face masks using fancy filters. Another use of face detection is in smartphone face ID security.

Some algorithms detect what is either a face(1) or not a face(0) in an image which is called as classifiers, in Face Detection. Classifiers have been trained to detect faces using thousands to millions of images to get more accuracy. LBP (Local Binary Pattern) and Haar Cascades are two main types of classifiers used in OpenCV. I will be using the latter classifier.

Furthermore, this document will take you to a model that is developed in python, which can be used to detect whether a person is sleeping or not. That can be useful to train a system to take the view taking from a camera that will be placed in vehicles to detect the driver’s eyes and keep the driver alarmed of sleeping while driving.

Day 01

A classifier is an algorithm that sorts data into labeled classes or categories of information. A simple practical example is spam filters that scan incoming “raw” emails and classify them as either “spam” or “not-spam.” Classifiers are a concrete implementation of pattern recognition in many forms of machine learning. Classifiers are where high-end machine theory meets application. These algorithms are quite an easy sorting device to arrange or “map” unlabeled data instances into discrete classes. Classifiers are with a set of dynamic rules, which incorporates an interpretation procedure to handle vague or unknown values, all tailored to the sort of inputs being examined. Most classifiers also employ probability estimates that allow end-users to control data classification with utility functions. In unsupervised learning, classifiers form the backbone of cluster analysis and in supervised or semi-supervised learning, classifiers are how the system characterizes and evaluates unlabeled data.

Common Types of Classification Algorithms in Machine Learning:

Since no single sort of classification is acceptable for all datasets, a huge toolkit of off-the-shelf
classifiers is available for developers to experiment with.

From all the above-mentioned classifier types, cascade classifiers are used in this model.

This is the first out of a series of five articles. See you tomorrow with more! Stay tuned!!!

Day 01

Day 02

Day 03 –

Day 04 –

Day 05 –

Full code available at:


Comments are closed.