Drowsy driving is one of the major causes of road accidents. When drivers become tired, their reaction time slows and they may fall asleep. SafeDrive AI continuously monitors the driver using a camera and detects early signs of sleepiness. If the system notices that the driver’s eyes remain closed for a longer time, it triggers an alert. This warning helps the driver wake up or take a break, reducing the risk of accidents. This system can be used in cars, trucks, taxis, buses, and long-distance transport vehicles.
Main features of the AI system.
One important feature is real-time face and eye detection. The AI uses a camera to capture live video of the driver. A computer vision model detects the face and identifies important points around the eyes called facial landmarks. These points help the system measure whether the eyes are open or closed.
Another key feature is Eye Aspect Ratio (EAR) analysis. The system calculates a value called the Eye Aspect Ratio from the eye landmarks. When the eyes are open, the EAR value is higher. When the eyes close, the EAR value decreases. If the value stays below a certain threshold for several frames, the system interprets this as drowsiness.
The project also includes real-time monitoring and statistics. The system tracks how long the session has been running, how many frames have been processed, and how many alerts were triggered. This helps monitor the performance of the system during operation.
Another feature is adjustable drowsiness sensitivity. The threshold slider allows the user to control how strict the detection is. A strict threshold detects sleepiness quickly, while a lenient threshold allows normal blinking without triggering alerts too often.
The system also provides alert and warning functionality. When drowsiness is detected, the AI activates an alert such as a sound or notification. This immediately warns the driver and encourages them to stay awake or take a break.
It also has an event logging system. The event log records important actions like system initialization, camera start, and alerts. This is useful for debugging and system analysis.
Technical details of the AI system
The project is built using Python and uses computer vision libraries. The webcam captures video frames using OpenCV. A facial landmark detection model (such as MediaPipe or Dlib) identifies the eye positions. Using these points, the program calculates the Eye Aspect Ratio for each frame. If the EAR value stays below the threshold for a certain number of frames, the AI concludes that the driver may be falling asleep and triggers an alert.
The system processes video frames continuously, meaning the detection happens in real time. This makes the system responsive and capable of warning the driver immediately.