Skip to content

aghaPathan/Sleep-detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sleep Detector

A computer vision application that detects drowsiness by monitoring eye state using facial recognition.

Overview

This script uses OpenCV to detect faces and track eye state (open/closed) in real-time video, designed to alert drowsy drivers.

Features

  • 👁️ Eye State Detection — Monitors if eyes are open or closed
  • 😴 Drowsiness Alert — Detects when driver may be falling asleep
  • 📹 Real-time Processing — Works with live webcam feed
  • 🎯 Face Tracking — Locates and tracks face in frame

Requirements

  • Python 3.x
  • OpenCV (cv2)
  • dlib (for facial landmarks)
  • NumPy

Installation

pip install opencv-python dlib numpy

Usage

python sleep_detector.py

How It Works

  1. Captures video from webcam
  2. Detects face using Haar Cascade / dlib
  3. Identifies eye regions
  4. Calculates eye aspect ratio (EAR)
  5. Alerts if eyes closed for extended period

Applications

  • Driver drowsiness detection
  • Workplace fatigue monitoring
  • Safety systems

License

MIT


CI Status

All PRs are checked for:

  • ✅ Syntax (Python, JS, TS, YAML, JSON, Dockerfile, Shell)
  • ✅ Secrets (No hardcoded credentials)
  • ✅ Security (High-severity vulnerabilities)

About

This script contains code to detect a face and target it's state of eyes, either open or close for different applications. There it is used to detect if the driver is asleep or not while driving.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages