Built to order

Driver Drowsiness Detection using Eye Tracking

A safety system that watches the driver's eyes through a webcam, computes the eye-aspect-ratio with facial landmarks and triggers a loud alert when drowsiness is detected. Built with OpenCV and dlib/MediaPipe, it logs drowsy events with timestamps — a socially impactful AI project with a compelling live demo.

Drowsiness detection project thumbnail showing a driver's eyes tracked with facial landmarks and an eye-aspect-ratio alert overlay.
More project photos (2)

The problem

The Driver Drowsiness Detection system is a real-time road-safety final-year project that watches a driver's eyes through an ordinary webcam and raises a loud audible alarm the moment drowsiness is detected. Built with OpenCV and dlib's 68-point facial landmarks (with a MediaPipe alternative), the system computes the Eye Aspect Ratio (EAR) for every frame and triggers an alert when the eyes stay closed beyond a calibrated threshold. Branded WakeGuard, the application logs every drowsy event with timestamps for review analysis, giving you a socially impactful AI project with a live demo examiners remember.

This is a built-to-order project: every deliverable is prepared fresh for you — full source code, report PDF, PPT and viva Q&A — so nothing looks recycled.

How it works

  1. The webcam captures video; OpenCV detects the face each frame (HOG-based or DNN face detector).
  2. dlib's 68-point landmark predictor (or MediaPipe Face Mesh) marks the six key points of each eye.
  3. The Eye Aspect Ratio is computed per eye: vertical eye distances divided by the horizontal distance. Typical open-eye EAR ≈ 0.25–0.30; closed eye ≈ 0.15.
  4. A counter increments while EAR stays below the calibrated threshold and resets when eyes open — only sustained closures (e.g. 48+ consecutive frames ≈ 1.5–2 s) count as drowsiness, filtering out normal blinks.
  5. When the counter exceeds the limit, pygame fires a loud alarm and the event is logged with a timestamp and duration.
  6. The dashboard plots the live EAR curve so the examiner can see drowsiness as it happens.

Project features

  • Real-time face and eye tracking from any standard webcam — no special hardware
  • Eye Aspect Ratio (EAR) computed per frame from 68-point facial landmarks (dlib)
  • MediaPipe Face Mesh alternative with 468 landmarks for higher precision
  • Calibrated drowsiness logic: consecutive-frame counter + personalized EAR threshold
  • Loud audio alert via pygame when drowsiness is confirmed (wakes the driver)
  • Visual dashboard: live EAR graph, eye status indicator, alert history
  • Timestamped event log (CSV) with drowsy-episode durations for report analysis
  • Works with spectacles; configurable sensitivity for different face geometries
  • Calibration wizard that measures your personal open-eye and closed-eye EAR values

What is included

  • Complete, commented Python source code (detection, alerting, dashboard)
  • Calibration wizard script for personal EAR thresholds
  • Project report PDF (literature survey, EAR methodology, experiments, results, conclusion)
  • PPT presentation for final review
  • Viva Q&A preparation document (landmark theory, EAR derivation, threshold logic)
  • Installation and run guide (dlib build notes for Windows/Linux)
Components & software requirements
  • Python 3.9+ (NumPy, SciPy for the EAR computation)
  • OpenCV (face detection, video capture, overlay rendering)
  • dlib 68-point facial landmark model (shape_predictor_68_face_landmarks.dat)
  • MediaPipe Face Mesh (alternative landmark pipeline)
  • pygame (audio alarm)
  • Tkinter / Streamlit dashboard (live EAR graph + event log)
  • CSV logging for drowsy-event analysis

Download abstract (PDF)

Related guides

All guides
Blueprint-style technical illustration of multiple decision trees voting together into one final predictionStudents with basic Python and pandas skills who want a reliable first classifier for ML coursework and tabular data projects.

Random Forests Explained: Why Decision Trees Vote Better Together

Decision trees are readable but overfit; random forests fix this by training hundreds of varied trees on bootstrapped data with random feature subsets, then letting them vote. This guide explains Gini impurity, bagging, out-of-bag validation and the four hyperparameters that matter, with a complete scikit-learn workflow, honest feature-importance practices, and the mistakes students keep making.

Read guide
Illustration of object tracking showing video frames with bounding boxes and persistent ID labels following people and vehicles, comparing motion prediction and appearance matching.B.E./B.Tech Computer Science and Electronics students building video analytics projects — people counting, vehicle tracking, sports analysis — who have detection working and need

Object Tracking: DeepSORT and ByteTrack Explained

Detection finds objects per frame; tracking keeps their identities across frames. This guide explains tracking-by-detection, Kalman motion models, DeepSORT's appearance embeddings vs ByteTrack's low-confidence box recovery, tracking metrics (HOTA, IDF1, ID switches), and the tuning parameters that determine real-world quality.

Read guide
Illustration of image segmentation showing U-Net's U-shaped encoder-decoder with skip connections producing pixel masks, alongside Mask R-CNN detecting instances with masks.B.E./B.Tech Computer Science and AI/ML students moving from image classification or detection to pixel-level understanding — medical imaging, defect detection, autonomous driving

Image Segmentation: U-Net and Mask R-CNN

When projects need pixel-level answers, segmentation delivers. This guide explains semantic vs instance vs panoptic segmentation, U-Net's encoder-decoder with skip connections, Mask R-CNN's parallel mask head, Dice and IoU evaluation, paired augmentation, and how to choose the right architecture for your data and question.

Read guide
Get a quotation