← Back to projects

Computer Vision · Edge AI · 2026

DriveGuard AI — Driver Monitoring System

Multi-person driver safety monitoring with Z-Mesh dynamic baseline calibration.

PythonOpenCVMediaPipeYOLOv8CustomTkinterNumPyMatplotlib

up to 6

People tracked

5 sec

Calibration

0–100

Risk index

100%

Runs offline

The problem

Generic drowsiness detectors use fixed thresholds, so they misfire on faces that differ from the average — and cloud processing of in-car video raises real privacy concerns.

The solution

A fully offline system that profiles each driver's face on startup, builds a personal statistical baseline, and only raises an alert when an anomaly persists long enough to be real.

Detection pipeline

  • Live frames captured with OpenCV and tracked across frames by Euclidean identity mapping
  • MediaPipe Face Mesh landmarks → Eye Aspect Ratio, Mouth Aspect Ratio, 3D head pose (solvePnP)
  • YOLOv8 detects cell phones inside each registered bounding box every N frames to save CPU
  • Z-score anomaly detection against the driver's own calibration baseline

Temporal confirmation

Raw anomalies must persist before an alarm fires, which removes blinks and mirror checks.

  • Drowsiness — eyes closed for 2.0 s
  • Yawning — mouth wide open for 1.5 s
  • Distraction — head turned away for 2.5 s, with hysteresis under 0.4 s
  • Phone usage — phone held for 1.5 s, ignoring occlusions under 0.8 s

Explainable risk engine

  • Base weights: phone +30, drowsiness +25, distraction +15, yawning +10
  • Escalation while a violation stays unresolved, plus a repetition penalty
  • Decay of 10 points/sec once the driver returns to a safe state
  • Dark-mode command center with live telemetry, event log and trip summary

Results & impact

  • Personal calibration removes the false alerts that fixed thresholds produce
  • Runs entirely on edge hardware — no video ever leaves the vehicle
  • Session reports explain what happened and which factors drove the risk score

More projects