Loading repository data…
Loading repository data…
menuka400 / repository
AI-powered driver safety monitor — real-time drowsiness, gaze tracking, phone & smoke detection using YOLO11x, MediaPipe & HRNetV2. ESP32 IoT hardware alerts, Blynk app, full GPU acceleration.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Advanced AI-Powered Driver Safety Monitoring System with IoT Integration
Real-time detection of drowsiness, distraction, phone usage, and smoking with ESP32 hardware alerts

Professional IoT project poster showcasing the complete system architecture, research methodology, hardware design, and real-world applications of the Driver Safety Guard 2.0 system
🚀 Fully GPU-Optimized Mobile Phone and Face Tracker with Gaze Direction
======================================================================
Features:
📱 YOLO11x Mobile Phone Detection
👤 YOLOv11l Face Detection
👁️ MediaPipe Eye State Detection
👀 MediaPipe Gaze Direction Tracking
🧠 HRNetV2 Feature Extraction
🔊 Smart TTS Alerts
⚡ Full GPU Acceleration
📡 ESP32 Communication
⏱️ Continuous gaze tracking for TTS triggers
🏗️ Professional Modular Architecture
======================================================================
Driver Safety Guard 2.0 is a cutting-edge, fully GPU-optimized AI system that monitors driver behavior in real-time using state-of-the-art machine learning models. Unlike traditional systems, it combines , , and to provide comprehensive safety monitoring.
| Feature | Technology | Status |
|---|---|---|
| Phone Detection | YOLO11x | ✅ Production Ready |
| Face Detection | YOLOv11l-face | ✅ Production Ready |
| Drowsiness Detection | MediaPipe + Eye State | ✅ Production Ready |
| Gaze Tracking | MediaPipe Facial Landmarks | ✅ Production Ready |
| Smoke Detection | MQ2 Sensor + ESP32 | ✅ Production Ready |
| Text-to-Speech Alerts | pyttsx3 | ✅ Production Ready |
| ESP32 Communication | HTTP REST API | ✅ Production Ready |
| Blynk App Integration | IoT Platform | ✅ Production Ready |
| Real-time Tracking | HRNetV2 Feature Extraction | ✅ Production Ready |
┌─────────────────────────────────────────────────────────────────┐
│ Driver Safety Guard 2.0 │
├─────────────────────────────────────────────────────────────────┤
│ 📹 Camera Input │
│ └── Real-time video stream processing │
├─────────────────────────────────────────────────────────────────┤
│ 🧠 AI Detection Engine │
│ ├── 📱 Phone Detection (YOLO11x) │
│ ├── 👤 Face Detection (YOLOv11l-face) │
│ ├── 👁️ Drowsiness Detection (MediaPipe) │
│ └── 👀 Gaze Direction Tracking (MediaPipe) │
├─────────────────────────────────────────────────────────────────┤
│ 🎯 Tracking & Feature Extraction │
│ ├── 🔍 Multi-object Tracking │
│ └── 🧬 HRNetV2 Feature Extraction │
├─────────────────────────────────────────────────────────────────┤
│ 📡 Communication Layer │
│ ├── 🔊 Text-to-Speech Alerts │
│ ├── 📱 ESP32 HTTP Communication │
│ └── ☁️ Blynk IoT Platform │
├─────────────────────────────────────────────────────────────────┤
│ 🛠️ Hardware Integration │
│ ├── 💡 RGB LED Alert System │
│ ├── 🔔 Audio Buzzer Alerts │
│ ├── 🚨 MQ2 Smoke Detection │
│ └── 🌡️ Temperature Monitoring │
└─────────────────────────────────────────────────────────────────┘
🔴 Red LED → Distracted driving detected
🟡 Yellow LED → Drowsiness warning
🔵 Blue LED → Phone usage alert
🟠 Orange LED → Smoking detected
🟢 Green LED → System normal/idle
git clone https://github.com/menuka400/Driver-Safety-Guard-2.0.git
cd Driver-Safety-Guard-2.0
# Windows (PowerShell)
python -m venv venv
.\venv\Scripts\Activate.ps1
# Linux/macOS
python3 -m venv venv
source venv/bin/activate
# Install from setup.py (recommended)
pip install -e .
# Or install manually
pip install -r requirements.txt
python utils/download_models.py
# Copy and edit configuration
cp config/default_config.json config/your_config.json
# Edit your_config.json with your preferences
python main.py
# Install required libraries:
# - WiFi
# - WebServer
# - BlynkSimpleEsp32
# - OneWire
# - DallasTemperature
# - ESPmDNS
# Open arduino/main/main.ino in Arduino IDE
# Configure WiFi credentials and Blynk token
# Upload to ESP32 board
# Find ESP32 IP address from serial monitor
# Update config/your_config.json with ESP32 IP
# Test connection: ping YOUR_ESP32_IP
{
"detection": {
"confidence_threshold": 0.7,
"phone_detection_enabled": true,
"face_detection_enabled": true,
"drowsiness_detection_enabled": true,
"gaze_tracking_enabled": true
},
"gpu": {
"enabled": true,
"device": "auto",
"mixed_precision": true
},
"esp32": {
"ip": "192.168.1.100",
"port": 80,
"enabled": true
},
"alerts": {
"tts_enabled": true,
"voice_rate": 150,
"volume": 0.8,
"gaze_threshold_seconds": 3.0
}
}
| Parameter | Description | Default | Range |
|---|---|---|---|
confidence_threshold | AI model confidence level | 0.7 | 0.1-0.95 |
gaze_threshold_seconds | Gaze distraction trigger time | 3.0 | 1.0-10.0 |
voice_rate | TTS speech rate | 150 | 50-300 |
alert_cooldown | Time between repeated alerts | 2.0 | 0.5-10.0 |
# Start with default configuration
python main.py
# Use custom configuration
python main.py --config config/your_config.json
# Enable debug mode
python main.py --debug
# Disable GPU acceleration
python main.py --no-gpu
python main.py [OPTIONS]
Options:
--config PATH Configuration file path
--debug Enable debug logging
--no-gpu Disable GPU acceleration
--camera-id INT Camera device ID (default: 0)
--esp32-ip IP ESP32 device IP address
--help Show help message
TMPL657qAruym# Copy auth token from Blynk app
# Update arduino/main/main.ino with your token
# Re-upload ESP32 firmware
Access the ESP32 web dashboard at: `http://YOUR_E