

{"id":70571,"date":"2019-10-01T17:58:15","date_gmt":"2019-10-01T12:28:15","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=70571"},"modified":"2025-07-28T20:55:23","modified_gmt":"2025-07-28T15:25:23","slug":"python-project-driver-drowsiness-detection-system","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/python-project-driver-drowsiness-detection-system\/","title":{"rendered":"Driver Drowsiness Detection System with OpenCV &amp; Keras"},"content":{"rendered":"<p>With this Python project, we will be making a drowsiness detection system. A countless number of people drive on the highway day and night. Taxi drivers, bus drivers, truck drivers and people traveling long-distance suffer from lack of sleep. Due to which it becomes very dangerous to drive when feeling sleepy.<\/p>\n<p>The majority of accidents happen due to the drowsiness of the driver. So, to prevent these accidents we will build a system using Python, OpenCV, and Keras which will alert the driver when he feels sleepy.<\/p>\n<p>DataFlair has also published other <em>machine learning project ideas with source code<\/em>. You can check them from this ml projects list:<\/p>\n<ol>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/advanced-python-project-detecting-fake-news\/\">Fake News Detection Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-machine-learning-project-detecting-parkinson-disease\/\">Parkinson\u2019s Disease Detection Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/project-in-python-colour-detection\/\">Color Detection Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-mini-project-speech-emotion-recognition\/\">Speech Emotion Recognition Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/project-in-python-breast-cancer-classification\/\">Breast Cancer Classification Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-project-gender-age-detection\/\">Age and Gender Detection Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-deep-learning-project-handwritten-digit-recognition\/\">Handwritten Digit Recognition Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-chatbot-project\/\">Chatbot Python Project<\/a><\/li>\n<li><span class=\"keyword _ngcontent-jpw-83\">Drowsy\u00a0Driver Safety Alert System Python Project<\/span><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-project-traffic-signs-recognition\/\">Traffic Signs Recognition Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-based-project-image-caption-generator-cnn\/\">Image Caption Generator Python Project<\/a><\/li>\n<\/ol>\n<h3>Drowsy Driver Alert System<\/h3>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Python-Project-on-Driver-Drowsiness-Detection-System-video-vv3.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-72728\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Python-Project-on-Driver-Drowsiness-Detection-System-video-vv3.gif\" alt=\"Intermediate Python Project - Driver Drowsiness Detection System\" width=\"637\" height=\"510\" \/><\/a><\/p>\n<p>Drowsiness detection is a safety technology that can prevent accidents that are caused by drivers who fell asleep while driving.<\/p>\n<p>The objective of this intermediate Python project is to build a drowsiness detection system that will detect that a person&#8217;s eyes are closed for a few seconds. This system will alert the driver when drowsiness is detected.<\/p>\n<h3><span class=\"keyword _ngcontent-jpw-83\">Driver\u00a0<\/span>Drowsiness Detection System<\/h3>\n<p>In this Python project, we will be using OpenCV for gathering the images from webcam and feed them into a <a href=\"https:\/\/data-flair.training\/blogs\/deep-learning-tutorial\/\"><em><strong>Deep Learning<\/strong><\/em><\/a> model which will classify whether the person&#8217;s eyes are \u2018Open\u2019 or \u2018Closed\u2019. The approach we will be using for this Python project is as follows :<\/p>\n<p><strong>1.<\/strong>\u00a0Take image as input from a camera.<\/p>\n<p><strong>2.<\/strong>\u00a0Detect the face in the image and create a Region of Interest (ROI).<\/p>\n<p><strong>3.<\/strong>\u00a0Detect the eyes from ROI and feed it to the classifier.<\/p>\n<p><strong>4.<\/strong>\u00a0Classifier will categorize whether eyes are open or closed.<\/p>\n<p><strong>5.<\/strong>\u00a0Calculate score to check whether the person is drowsy.<\/p>\n<h3>Driver Drowsiness Detection Dataset<\/h3>\n<p>The dataset used for this model is created by us. To create the dataset, we wrote a script that captures eyes from a camera and stores in our local disk. We separated them into their respective labels \u2018Open\u2019 or \u2018Closed\u2019. The data was manually cleaned by removing the unwanted images which were not necessary for building the model. The data comprises around 7000 images of people&#8217;s eyes under different lighting conditions. After training the model on our dataset, we have attached the final weights and model architecture file \u201cmodels\/cnnCat2.h5\u201d.<\/p>\n<p>Now, you can use this model to classify if a person\u2019s eye is open or closed.<\/p>\n<p>Alternatively, if you want to build and train your own model, you can download the dataset: <a href=\"https:\/\/data-flair.training\/blogs\/download-driver-drowsiness-detection-project-data\/\"><strong>Driver Drowsiness Dataset<\/strong><\/a><\/p>\n<h3>The Model Architecture<\/h3>\n<p>The model we used is built with Keras using<strong> Convolutional Neural Networks (CNN)<\/strong>. A convolutional neural network is a special type of deep neural network which performs extremely well for image classification purposes. A CNN basically consists of an input layer, an output layer and a hidden layer which can have multiple layers. A convolution operation is performed on these layers using a filter that performs 2D matrix multiplication on the layer and filter.<\/p>\n<p>The CNN model architecture consists of the following layers:<\/p>\n<ul>\n<li>Convolutional layer; 32 nodes, kernel size 3<\/li>\n<li>Convolutional layer; 32 nodes, kernel size 3<\/li>\n<li>Convolutional layer; 64 nodes, kernel size 3<\/li>\n<li>Fully connected layer; 128 nodes<\/li>\n<\/ul>\n<p>The final layer is also a fully connected layer with 2 nodes. A Relu activation function is used in all the layers except the output layer in which we used Softmax.<\/p>\n<h3>Project Prerequisites<\/h3>\n<p>The requirement for this Python project is a webcam through which we will capture images. You need to have Python (3.6 version recommended) installed on your system, then using pip, you can install the necessary packages.<\/p>\n<ol>\n<li><strong>OpenCV &#8211;<\/strong> pip install opencv-python (face and eye detection).<\/li>\n<li><strong>TensorFlow &#8211;<\/strong> pip install tensorflow (keras uses TensorFlow as backend).<\/li>\n<li><strong>Keras &#8211;<\/strong> pip install keras (to build our classification model).<\/li>\n<li><strong>Pygame &#8211;<\/strong> pip install pygame (to play alarm sound).<\/li>\n<\/ol>\n<h3>Steps for Performing Driver Drowsiness Detection<\/h3>\n<p>Download the driver drowsiness detection system project source code from the zip and extract the files in your system: <a href=\"https:\/\/drive.google.com\/open?id=1zodAMJQFuqThN3sKQ9Bcb76gUSFIMPrG\"><b>Driver Drowsiness Project Code<\/b><\/a><\/p>\n<p>The contents of the zip are:<\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Project-File-Structure.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"img-gray-border aligncenter wp-image-70599 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Project-File-Structure.jpg\" alt=\"Project File Structure - Intermediate Python Project\" width=\"814\" height=\"626\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Project-File-Structure.jpg 814w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Project-File-Structure-150x115.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Project-File-Structure-300x231.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Project-File-Structure-768x591.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Project-File-Structure-520x400.jpg 520w\" sizes=\"auto, (max-width: 814px) 100vw, 814px\" \/><\/a><\/p>\n<ul>\n<li>The \u201chaar cascade files\u201d folder consists of the xml files that are needed to detect objects from the image. In our case, we are detecting the face and eyes of the person.<\/li>\n<li>The models folder contains our model file \u201ccnnCat2.h5\u201d which was trained on convolutional neural networks.<\/li>\n<li>We have an audio clip \u201calarm.wav\u201d which is played when the person is feeling drowsy.<\/li>\n<li>\u201cModel.py\u201d file contains the program through which we built our classification model by training on our dataset. You could see the implementation of convolutional neural network in this file.<\/li>\n<li>\u201cDrowsiness detection.py\u201d is the main file of our project. To start the detection procedure, we have to run this file.<\/li>\n<\/ul>\n<p>Let\u2019s now understand how our algorithm works step by step.<\/p>\n<p><strong>Step 1 &#8211; Take Image as Input from a Camera<\/strong><\/p>\n<p>With a webcam, we will take images as input. So to access the webcam, we made an infinite loop that will capture each frame. We use the method provided by OpenCV, <strong>cv2.VideoCapture(0)<\/strong> to access the camera and set the capture object (cap). <strong>cap.read()<\/strong> will read each frame and we store the image in a frame variable.<\/p>\n<p><strong>Step 2 &#8211; Detect Face in the Image and Create a Region of Interest (ROI)<\/strong><\/p>\n<p>To detect the face in the image, we need to first convert the image into grayscale as the OpenCV algorithm for object detection takes gray images in the input. We don\u2019t need color information to detect the objects. We will be using haar cascade classifier to detect faces. This line is used to set our classifier <strong>face = cv2.CascadeClassifier(\u2018 path to our haar cascade xml file\u2019)<\/strong>. Then we perform the detection using <strong>faces = face.detectMultiScale(gray)<\/strong>. It returns an array of detections with x,y coordinates, and height, the width of the boundary box of the object. Now we can iterate over the faces and draw boundary boxes for each face.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">for (x,y,w,h) in faces: \r\n        cv2.rectangle(frame, (x,y), (x+w, y+h), (100,100,100), 1 )<\/pre>\n<p><strong>Step 3 &#8211; Detect the eyes from ROI and feed it to the classifier<\/strong><\/p>\n<p>The same procedure to detect faces is used to detect eyes. First, we set the cascade classifier for eyes in <strong>leye<\/strong> and <strong>reye<\/strong> respectively then detect the eyes using<strong> left_eye = leye.detectMultiScale(gray)<\/strong>. Now we need to extract only the eyes data from the full image. This can be achieved by extracting the boundary box of the eye and then we can pull out the eye image from the frame with this code.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">l_eye = frame[ y : y+h, x : x+w ]<\/pre>\n<p><strong>l_eye<\/strong> only contains the image data of the eye. This will be fed into our CNN classifier which will predict if eyes are open or closed. Similarly, we will be extracting the right eye into <strong>r_eye<\/strong>.<\/p>\n<p><strong>Step 4 &#8211; Classifier will Categorize whether Eyes are Open or Closed<\/strong><\/p>\n<p>We are using <a href=\"https:\/\/en.wikipedia.org\/wiki\/Convolutional_neural_network\">CNN<\/a> classifier for predicting the eye status. To feed our image into the model, we need to perform certain operations because the model needs the correct dimensions to start with. First, we convert the color image into grayscale using<strong> r_eye = cv2.cvtColor(r_eye, cv2.COLOR_BGR2GRAY)<\/strong>. Then, we resize the image to 24*24 pixels as our model was trained on 24*24 pixel images <strong>cv2.resize(r_eye, (24,24))<\/strong>. We normalize our data for better convergence <strong>r_eye = r_eye\/255\u00a0<\/strong>(All values will be between 0-1). Expand the dimensions to feed into our classifier. We loaded our model using <strong>model = load_model(\u2018models\/cnnCat2.h5\u2019)<\/strong> . Now we predict each eye with our model<br \/>\n<strong>lpred = model.predict_classes(l_eye)<\/strong>. If the value of lpred[0] = 1, it states that eyes are open, if value of lpred[0] = 0 then, it states that eyes are closed.<\/p>\n<p><strong>Step 5 &#8211; Calculate Score to Check whether Person is Drowsy<\/strong><\/p>\n<p>The score is basically a value we will use to determine how long the person has closed his eyes. So if both eyes are closed, we will keep on increasing score and when eyes are open, we decrease the score. We are drawing the result on the screen using cv2.putText() function which will display real time status of the person.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">cv2.putText(frame, \u201cOpen\u201d, (10, height-20), font, 1, (255,255,255), 1, cv2.LINE_AA )<\/pre>\n<p>A threshold is defined for example if score becomes greater than 15 that means the person&#8217;s eyes are closed for a long period of time. This is when we beep the alarm using <strong>sound.play()<\/strong><\/p>\n<p><strong>The Source Code of our main file looks like this:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">import cv2\r\nimport os\r\nfrom keras.models import load_model\r\nimport numpy as np\r\nfrom pygame import mixer\r\nimport time\r\n\r\nmixer.init()\r\nsound = mixer.Sound('alarm.wav')\r\n\r\nface = cv2.CascadeClassifier('haar cascade files\\haarcascade_frontalface_alt.xml')\r\nleye = cv2.CascadeClassifier('haar cascade files\\haarcascade_lefteye_2splits.xml')\r\nreye = cv2.CascadeClassifier('haar cascade files\\haarcascade_righteye_2splits.xml')\r\n\r\nlbl=['Close','Open']\r\n\r\nmodel = load_model('models\/cnncat2.h5')\r\npath = os.getcwd()\r\ncap = cv2.VideoCapture(0)\r\nfont = cv2.FONT_HERSHEY_COMPLEX_SMALL\r\ncount=0\r\nscore=0\r\nthicc=2\r\nrpred=[99]\r\nlpred=[99]\r\n\r\nwhile(True):\r\n    ret, frame = cap.read()\r\n    height,width = frame.shape[:2]\r\n\r\n    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)\r\n\r\n    faces = face.detectMultiScale(gray,minNeighbors=5,scaleFactor=1.1,minSize=(25,25))\r\n    left_eye = leye.detectMultiScale(gray)\r\n    right_eye = reye.detectMultiScale(gray)\r\n\r\n    cv2.rectangle(frame, (0,height-50) , (200,height) , (0,0,0) , thickness=cv2.FILLED )\r\n\r\n    for (x,y,w,h) in faces:\r\ncv2.rectangle(frame, (x,y) , (x+w,y+h) , (100,100,100) , 1 )\r\n\r\n    for (x,y,w,h) in right_eye:\r\n        r_eye=frame[y:y+h,x:x+w]\r\n        count=count+1\r\n        r_eye = cv2.cvtColor(r_eye,cv2.COLOR_BGR2GRAY)\r\n        r_eye = cv2.resize(r_eye,(24,24))\r\n        r_eye= r_eye\/255\r\n        r_eye= r_eye.reshape(24,24,-1)\r\n        r_eye = np.expand_dims(r_eye,axis=0)\r\n        rpred = model.predict_classes(r_eye)\r\n        if(rpred[0]==1):\r\n            lbl='Open'\r\n        if(rpred[0]==0):\r\n            lbl='Closed'\r\n        break\r\n\r\n    for (x,y,w,h) in left_eye:\r\n        l_eye=frame[y:y+h,x:x+w]\r\n        count=count+1\r\n        l_eye = cv2.cvtColor(l_eye,cv2.COLOR_BGR2GRAY)\r\n        l_eye = cv2.resize(l_eye,(24,24))\r\n        l_eye= l_eye\/255\r\n        l_eye=l_eye.reshape(24,24,-1)\r\n        l_eye = np.expand_dims(l_eye,axis=0)\r\n        lpred = model.predict_classes(l_eye)\r\n        if(lpred[0]==1):\r\n            lbl='Open'\r\n        if(lpred[0]==0):\r\n            lbl='Closed'\r\n        break\r\n\r\n    if(rpred[0]==0 and lpred[0]==0):\r\n        score=score+1\r\n        cv2.putText(frame,\"Closed\",(10,height-20), font, 1,(255,255,255),1,cv2.LINE_AA)\r\n    # if(rpred[0]==1 or lpred[0]==1):\r\n    else:\r\n        score=score-1\r\n        cv2.putText(frame,\"Open\",(10,height-20), font, 1,(255,255,255),1,cv2.LINE_AA)\r\n\r\n    if(score&lt;0):\r\n        score=0\r\n    cv2.putText(frame,'Score:'+str(score),(100,height-20), font, 1,(255,255,255),1,cv2.LINE_AA)\r\n    if(score&gt;15):\r\n        #person is feeling sleepy so we beep the alarm\r\n        cv2.imwrite(os.path.join(path,'image.jpg'),frame)\r\n        try:\r\n            sound.play()\r\n\r\n        except: # isplaying = False\r\n            pass\r\n        if(thicc&lt;16):\r\n            thicc= thicc+2\r\n        else:\r\n            thicc=thicc-2\r\n            if(thicc&lt;2):\r\n                thicc=2\r\n        cv2.rectangle(frame,(0,0),(width,height),(0,0,255),thicc)\r\n    cv2.imshow('frame',frame)\r\n    if cv2.waitKey(1) &amp; 0xFF == ord('q'):\r\n        break\r\ncap.release()\r\ncv2.destroyAllWindows()<\/pre>\n<h3>Driver Drowsiness Detection Execution<\/h3>\n<p>Let\u2019s execute drive drowsiness detection system and see the working of our ml project. To start the project, you need to open a command prompt, go to the directory where our main file \u201cdrowsiness detection.py\u201d exists. Run the script with this command.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">python \u201cdrowsiness detection.py\u201d<\/pre>\n<p>It may take a few seconds to open the webcam and start detection.<\/p>\n<p><strong>Example Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/running-drowsiness-program-python-project-example.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-70591\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/running-drowsiness-program-python-project-example.png\" alt=\"running drowsiness program - python project with source code\" width=\"978\" height=\"511\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/running-drowsiness-program-python-project-example.png 978w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/running-drowsiness-program-python-project-example-150x78.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/running-drowsiness-program-python-project-example-300x157.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/running-drowsiness-program-python-project-example-768x401.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/running-drowsiness-program-python-project-example-520x272.png 520w\" sizes=\"auto, (max-width: 978px) 100vw, 978px\" \/><\/a><\/p>\n<p><strong>Output Screenshot:<\/strong><\/p>\n<div id=\"attachment_70593\" style=\"width: 805px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/closed-eye-detection-python-project-ideas.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-70593\" class=\"wp-image-70593 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/closed-eye-detection-python-project-ideas.png\" alt=\"closed eye detection python project for beginners\" width=\"795\" height=\"637\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/closed-eye-detection-python-project-ideas.png 795w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/closed-eye-detection-python-project-ideas-150x120.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/closed-eye-detection-python-project-ideas-300x240.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/closed-eye-detection-python-project-ideas-768x615.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/closed-eye-detection-python-project-ideas-520x417.png 520w\" sizes=\"auto, (max-width: 795px) 100vw, 795px\" \/><\/a><p id=\"caption-attachment-70593\" class=\"wp-caption-text\">Closed Eye Detection<\/p><\/div>\n<div id=\"attachment_70595\" style=\"width: 807px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/open-eye-detection-python-project-for-practise.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-70595\" class=\"wp-image-70595 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/open-eye-detection-python-project-for-practise.png\" alt=\"Open Eyes Detection - python open source projects\" width=\"797\" height=\"637\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/open-eye-detection-python-project-for-practise.png 797w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/open-eye-detection-python-project-for-practise-150x120.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/open-eye-detection-python-project-for-practise-300x240.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/open-eye-detection-python-project-for-practise-768x614.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/open-eye-detection-python-project-for-practise-520x416.png 520w\" sizes=\"auto, (max-width: 797px) 100vw, 797px\" \/><\/a><p id=\"caption-attachment-70595\" class=\"wp-caption-text\">Open Eyes Detection<\/p><\/div>\n<div id=\"attachment_70596\" style=\"width: 811px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/sleep-alert-python-project.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-70596\" class=\"wp-image-70596 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/sleep-alert-python-project.png\" alt=\"sleep alert - python open source project\" width=\"801\" height=\"637\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/sleep-alert-python-project.png 801w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/sleep-alert-python-project-150x119.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/sleep-alert-python-project-300x239.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/sleep-alert-python-project-768x611.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/sleep-alert-python-project-520x414.png 520w\" sizes=\"auto, (max-width: 801px) 100vw, 801px\" \/><\/a><p id=\"caption-attachment-70596\" class=\"wp-caption-text\">Sleep Alert<\/p><\/div>\n<h3>Summary<\/h3>\n<p>Drowsy driving is one of the top causes of road accidents. When drivers get sleepy, they blink slower, close their eyes for longer, or even nod off. A smart system using Python, OpenCV, and Keras can help prevent such accidents. This system watches the driver&#8217;s face in real time and checks if their eyes are closing too often. If the system finds signs of drowsiness, it gives an alert like a beep or a message on the screen.<\/p>\n<p>In this Python project, we have built a\u00a0<span class=\"keyword _ngcontent-jpw-83\">drowsy driver alert system\u00a0<\/span>that you can implement in numerous ways. We used OpenCV to detect faces and eyes using a haar cascade classifier and then we used a CNN model to predict the status.<\/p>\n<p>This project is useful in real life. You can install it in cars to alert sleepy drivers. It also helps students understand how computer vision and machine learning work together. You\u2019ll learn how to work with real-time video, face detection, and Keras deep learning. It\u2019s a great safety-focused project for beginners and very impressive in interviews.<span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:1380,&quot;href&quot;:&quot;https:\\\/\\\/drive.google.com\\\/open?id=1zodAMJQFuqThN3sKQ9Bcb76gUSFIMPrG&quot;,&quot;archived_href&quot;:&quot;&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[],&quot;broken&quot;:false,&quot;last_checked&quot;:null,&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:1381,&quot;href&quot;:&quot;https:\\\/\\\/en.wikipedia.org\\\/wiki\\\/Convolutional_neural_network&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20251205195656\\\/https:\\\/\\\/en.wikipedia.org\\\/wiki\\\/Convolutional_neural_network&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-09 05:59:32&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-12 06:03:49&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-15 06:52:32&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-18 07:16:13&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-21 09:20:43&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-24 10:15:27&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-27 11:15:42&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-30 13:01:45&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-02 13:12:20&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-06 01:56:29&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-09 05:12:57&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-12 08:17:43&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-15 18:28:16&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-19 04:04:33&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-22 04:18:40&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-25 07:11:54&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-28 11:26:49&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-31 15:29:34&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-03 17:33:55&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-06 21:45:58&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-10 05:10:39&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-13 08:16:31&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-16 08:53:43&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-19 09:30:11&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-23 11:20:05&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-26 15:39:05&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-01 16:09:43&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-04 17:12:16&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-08 05:12:52&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-11 05:44:46&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-14 08:57:28&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-17 13:19:02&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-20 15:02:37&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-23 15:35:23&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-26 17:38:59&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-29 18:26:59&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-01 18:32:13&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-05 05:47:56&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-08 06:12:06&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-11 06:59:16&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-14 10:33:23&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-17 13:39:49&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-20 15:57:18&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-23 21:25:54&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-27 07:07:41&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-30 09:25:22&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-03 15:45:03&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-06 16:47:55&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-10 03:34:32&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-13 04:13:14&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-16 04:25:02&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-19 08:17:20&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-22 08:36:27&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-25 09:21:42&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-28 18:17:38&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-01 02:55:51&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-06-04 06:44:46&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-07 10:41:17&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-06-10 11:27:03&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-06-13 14:07:44&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-16 15:44:34&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-19 19:15:36&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-06-22 22:13:47&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-26 03:36:24&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-29 07:10:44&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-07-02 20:57:45&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-07-06 03:41:49&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-07-09 06:19:15&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-07-12 11:45:21&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-07-15 14:16:22&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-07-19 11:54:25&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-07-22 13:19:34&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-07-25 14:29:17&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-07-28 22:22:29&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-08-02 06:11:04&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-08-05 11:54:13&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-08-08 15:17:19&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-08-12 02:07:20&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-08-15 04:55:38&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-08-18 07:03:56&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-08-21 09:26:14&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-08-24 09:49:54&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-08-28 05:11:04&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-08-31 06:55:10&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-08-31 06:55:10&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>With this Python project, we will be making a drowsiness detection system. A countless number of people drive on the highway day and night. Taxi drivers, bus drivers, truck drivers and people traveling long-distance&#46;&#46;&#46;<\/p>\n","protected":false},"author":7,"featured_media":71659,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[21686,21169,20697,20623,21170],"class_list":["post-70571","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-machine-learning","tag-deep-learning-project","tag-driver-drowsiness","tag-machine-learning-project","tag-ml-project","tag-python-projects-for-final-year"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Driver Drowsiness Detection System with OpenCV &amp; Keras - DataFlair<\/title>\n<meta name=\"description\" content=\"Driver drowsiness detection system using OpenCV &amp; Keras - This Machine Learning project raises an alarm if driver feels sleepy while driving to avoid road accidents.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/python-project-driver-drowsiness-detection-system\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Driver Drowsiness Detection System with OpenCV &amp; Keras - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Driver drowsiness detection system using OpenCV &amp; Keras - This Machine Learning project raises an alarm if driver feels sleepy while driving to avoid road accidents.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/python-project-driver-drowsiness-detection-system\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-10-01T12:28:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-28T15:25:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Intermediate-python-project-driver-drowsiness-detection-system.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Driver Drowsiness Detection System with OpenCV &amp; Keras - DataFlair","description":"Driver drowsiness detection system using OpenCV & Keras - This Machine Learning project raises an alarm if driver feels sleepy while driving to avoid road accidents.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/python-project-driver-drowsiness-detection-system\/","og_locale":"en_US","og_type":"article","og_title":"Driver Drowsiness Detection System with OpenCV &amp; Keras - DataFlair","og_description":"Driver drowsiness detection system using OpenCV & Keras - This Machine Learning project raises an alarm if driver feels sleepy while driving to avoid road accidents.","og_url":"https:\/\/data-flair.training\/blogs\/python-project-driver-drowsiness-detection-system\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2019-10-01T12:28:15+00:00","article_modified_time":"2025-07-28T15:25:23+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Intermediate-python-project-driver-drowsiness-detection-system.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/python-project-driver-drowsiness-detection-system\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/python-project-driver-drowsiness-detection-system\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd"},"headline":"Driver Drowsiness Detection System with OpenCV &amp; Keras","datePublished":"2019-10-01T12:28:15+00:00","dateModified":"2025-07-28T15:25:23+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-project-driver-drowsiness-detection-system\/"},"wordCount":1700,"commentCount":234,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-project-driver-drowsiness-detection-system\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Intermediate-python-project-driver-drowsiness-detection-system.jpg","keywords":["deep learning project","Driver Drowsiness","machine learning project","ML project","python projects for final year"],"articleSection":["Machine Learning Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/python-project-driver-drowsiness-detection-system\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/python-project-driver-drowsiness-detection-system\/","url":"https:\/\/data-flair.training\/blogs\/python-project-driver-drowsiness-detection-system\/","name":"Driver Drowsiness Detection System with OpenCV &amp; Keras - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-project-driver-drowsiness-detection-system\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-project-driver-drowsiness-detection-system\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Intermediate-python-project-driver-drowsiness-detection-system.jpg","datePublished":"2019-10-01T12:28:15+00:00","dateModified":"2025-07-28T15:25:23+00:00","description":"Driver drowsiness detection system using OpenCV & Keras - This Machine Learning project raises an alarm if driver feels sleepy while driving to avoid road accidents.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/python-project-driver-drowsiness-detection-system\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/python-project-driver-drowsiness-detection-system\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/python-project-driver-drowsiness-detection-system\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Intermediate-python-project-driver-drowsiness-detection-system.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Intermediate-python-project-driver-drowsiness-detection-system.jpg","width":802,"height":420,"caption":"Intermediate python project - driver drowsiness detection system"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/python-project-driver-drowsiness-detection-system\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Machine Learning Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/machine-learning\/"},{"@type":"ListItem","position":3,"name":"Driver Drowsiness Detection System with OpenCV &amp; Keras"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team specializes in creating clear, actionable content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Backed by industry expertise, we make learning easy and career-oriented for beginners and pros alike.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam3\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/70571","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=70571"}],"version-history":[{"count":26,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/70571\/revisions"}],"predecessor-version":[{"id":146300,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/70571\/revisions\/146300"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/71659"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=70571"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=70571"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=70571"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}