A real-time driver safety monitoring system using Python and OpenCV for liveness detection (blink + motion), alerting, and face/eye recognition. Built for a hackathon.
- Real-time face and eye detection with Haar cascade classifiers
- Two-factor liveness detection (blink and motion monitoring)
- Alerts for camera block, missing driver, and static image (using sound and status indicators)
- Event logging with timestamps for safety incidents
- Configurable detection parameters and thresholds
- Threading for non-blocking audio alerts
- Python
- OpenCV
- Haar Cascade Classifiers
- threading (Python standard library)
- winsound (Windows alerts)
Webcam Input Module: Initializes and captures real-time video stream for face and eye monitoring.
Face & Eye Detection Module: Utilizes Haar cascades to detect and track facial features.
Liveness & Anomaly Detection: Monitors blink rates, face movement patterns, and other safety signals.
Alert & Logging System: Issues sound alerts and maintains logs when safety thresholds are crossed (e.g., driver inattentiveness or camera obstruction).
Display/Status Module: Continuously updates the display window with real-time safety status and logs.
Webcam Input
↓
Face Detection Module
↓
Eye Detection Module
↓
Blink Monitoring
↓
Head Movement Tracking
↓
Liveness Detection
↓
Anomaly Detection
↓
Alert & Logging System
↓
Display Output with Real-time Status
- Clone the repository git clone https://github.com/Baluwebsite/Safepath-crew- cd Safepath-crew
- Install Python dependencies pip install opencv-python numpy
- Make sure your webcam is working and you are running Windows (for sound alerts).
- Run the main script: python "final project.py"
- The webcam will activate for monitoring.
- Alerts and logs will trigger if liveness fails or anomalies are detected.
- Press
qto exit the program at any time.
- Captures video stream from webcam
- Detects face and eyes using Haar cascades
- Monitors blink patterns and face movement
- Sounds alerts and logs incidents if safety threshold is breached
- Provides real-time status on the display window
Contributions, suggestions, and bug reports are welcome.
Feel free to fork, create issues, or submit pull requests.
This project is licensed under the MIT License.
- For organizing the hackathon
- OpenCV community and documentation
- Hackathon participants and mentors