Skip to content
V

vigiledrive

driver fatique and distraction

Created on 8th March 2026

•

V

vigiledrive

driver fatique and distraction

The problem vigiledrive solves

The Problem
Road accidents are largely driven by split-second human errors: distracted driving and driver fatigue. Current Advanced Driver Assistance Systems (ADAS) are expensive and exclusive to luxury vehicles, leaving everyday drivers and commercial fleets vulnerable. VigileDrive bridges this gap by offering a low-cost, AI-powered safety net that retrofits into any vehicle.
Who Is It For?
Logistics & Trucking: Prevents cargo loss and fatal accidents by monitoring long-haul driver exhaustion.

Rideshare & Gig Economy (Uber/Lyft): Ensures passenger safety by strictly flagging phone usage during shifts.

Public Transit & School Buses: Adds an automated layer of oversight for operators.

Everyday Commuters: Provides enterprise-grade safety monitoring using just a standard webcam.
How It Makes Driving Safer
Proactive Prevention: Detects drowsiness via Eye Aspect Ratio and phone usage via YOLOv8 before an accident happens, triggering instant audio-visual alarms.

Zero Special Hardware: Runs efficiently on standard webcams without needing expensive infrared sensors or proprietary automotive hardware.

Objective Monitoring: Removes human bias. If your eyes close for too many frames, the system calculates the danger and forces you awake.

100% Privacy (Edge AI): Processes all video locally on the device. No video feed is ever recorded or uploaded to the cloud, ensuring total driver privacy.

Challenges we ran into

Building a real-time safety system sounds straightforward in theory, but moving from a "tutorial script" to a functional Vigil-Drive Dashboard involved overcoming several technical hurdles. Here are the most significant challenges I faced and the engineering solutions I used to solve them:

  1. The "Frozen UI" Problem (Multithreading)The Challenge: Initially, the system would "stutter" or completely freeze the video feed for 1 second whenever the alarm triggered. This happened because winsound.Beep is a blocking function—the entire program stops to wait for the sound to finish playing before moving to the next frame.The Solution: I implemented Threaded Alerting. By wrapping the alarm in a Python threading object, the sound runs on a separate CPU lane. This allows the video processing to continue at 30 FPS while the alarm plays in the background.Python# The fix: daemon=True ensures the thread dies if the main app closes
    threading.Thread(target=play_alarm, daemon=True).start()
  2. "One Size Doesn't Fit All" (Dynamic Calibration)The Challenge: I found that a fixed threshold for eye closure (e.g., 0.2) worked perfectly for me but failed for teammates with naturally "heavy" eyelids or different seating positions. A static system led to constant false positives, which makes a safety system untrustworthy.The Solution: I developed a Dynamic Calibration Phase. When the script starts, it doesn't begin monitoring immediately. Instead, it captures the user’s average $EAR$ over the first 100 frames.Calculation: It sets the "danger line" at 75% of the user's specific average.Result: This creates a personalized "baseline" for every driver, significantly improving accuracy across different ethnicities and lighting conditions.
  3. Coordinate Mapping for the DashboardThe Challenge: Drawing the live EAR/MAR graphs directly on the video frame was difficult. OpenCV uses a coordinate system where $(0,0)$ is the top-left, but math graphs usually go "up" from the bottom.The Solution: I wrote a custom normalization function within draw_plot(). It maps the history of EAR values (typically decimals between $0.1$ and $0.4$) to pixel offsets. I used a "Bottom-Up" subtraction logic:py = int((y + h) - (value / max_scale) * h)This ensures that as your eyes open wider (higher EAR), the line on the graph physically moves upwards, making it intuitive for the user to read.
  4. CPU Bottleneck & Model Optimization The Challenge: Running a full YOLOv8 model alongside MediaPipe Face Mesh was taxing the CPU, causing the frame rate to drop below 10 FPS. High latency is dangerous in a safety app; a 2-second lag could be the difference between a warning and an accident. The Solution: I shifted from the standard PyTorch (.pt) format to ONNX (Open Neural Network Exchange).The Result: The ONNX weights are optimized for "Edge" devices (standard laptop CPUs). This, combined with setting verbose=False in the YOLO prediction, boosted the performance back up to a smooth 25–30 FPS.5. Handling "Face Visibility" Logic The Challenge: If the driver looked away or the camera lost the face, the EAR would drop to zero, triggering a false "Drowsiness" alarm. The Solution: I added a Visibility Guard. The system now distinguishes between "Eyes Closed" and "Face Missing". If the face is gone, it displays a "DRIVER NOT VISIBLE" alert. It only increments the closed eye frames counter if a face is actively detected in the frame. This logic prevents the alarm from screaming every time the driver checks their side mirror.

Technologies used

Discussion

Builders also viewed

See more projects on Devfolio