AI-Based Accident Prevention System
AI-Based Accident Prevention System
BATCHLORE OF TECHNOLOGY
in
by
Submitted to the
CANDIDATE’S DECLARATION
I hereby declare that the work presented in this project titled, “AI ACCIDENT PREVENTION
SYSTEM ” submitted by us in the partial fulfilment of the requirement of the award of the degree of
Batchlor of Technology ([Link].) submitted in the Department of Computer Science & Engineering,
Uttarakhand Technical University, Dehradun, is an authentic record of my thesis carried out under the
guidance of MR. RAKESH ARYA, PROFESSOR, Department of Computer Science and Engineering
under SoEC, Dev Bhoomi Uttarakhand University, Dehradun
GARIMA NEGI
2
CERTIFICATE
It is to certify that the thesis entitled “AI ACCIDENT PREVENTION SYSTEM” which is being
submitted by Tashu Gupta, Muskaan Chauhan and Garima Negi to the Uttarakhand University
Dehradun, in the fulfilment of the requirement for the award of the degree of Batchlor of Technology
(B. Tech.) is a record of bonafide research work carried out by him under my guidance and supervision.
The matter presented in this thesis has not been submitted either in part or full to any University or
Institute for award of any degree.
[Link] ARYA
PROFESSOR
Department of Computer Science and Engg.
3
ABSTRACT
Road accidents have become a serious problem across the world and are one of the leading causes of injuries
and deaths. Most accidents occur due to human mistakes such as over-speeding, distraction, drunken driving,
and driver fatigue. Traditional safety measures like seat belts and airbags reduce injury but cannot fully
prevent accidents. With the rapid development of Artificial Intelligence (AI) and Machine Learning (ML),
smarter systems can now be used to predict and prevent accidents before they occur.
This project focuses on the design and development of an AI-Based Accident Prevention System that uses
cameras, sensors, and machine learning algorithms to monitor the driving environment in real time. The
system continuously observes the vehicle’s surroundings, including other vehicles, pedestrians, obstacles,
and road conditions. At the same time, it also monitors driver behavior such as eye movement, fatigue, and
inattentiveness.
Using computer vision and deep learning techniques, the system analyzes live video and sensor data to
detect dangerous situations like possible collisions, unsafe distance from other vehicles, lane deviation, and
driver drowsiness. When any risk is detected, the system immediately gives a warning alert to the driver
using sound alarms or visual notifications so that timely action can be taken.
The proposed system aims to reduce accident rates, improve road safety, and support the development of
smart and autonomous vehicles. It is a cost-effective and reliable solution that can be implemented in real
vehicles as well as traffic monitoring systems to save lives and prevent property loss.
4
ACKNOWLEDGEMENT
I would like to express my sincere gratitude and deep appreciation to my project guide, whose valuable
guidance, constant encouragement, and technical support made the successful completion of this project
possible. Their expert suggestions, continuous motivation, and timely feedback helped me at every stage of
this work.
I am extremely thankful to the Head of the Department and the faculty members of the Computer Science
and Engineering Department for providing the necessary infrastructure, facilities, and a healthy learning
environment to carry out this project smoothly.
I would also like to extend my heartfelt thanks to the management and administration of the college for
giving me the opportunity and resources to undertake this minor project as part of the [Link] curriculum.
My sincere appreciation goes to my friends and classmates who continuously supported me through
discussions, technical help, and teamwork during the development of this project.
Finally, I express my deepest gratitude to my parents and family members for their constant encouragement,
moral support, and blessings, without which this project would not have been successfully completed.
GARIMA NEGI
5
TABLE OF CONTENTS
6
CHAPTER 4: IMPLEMENTATION & RESULTS .................... 27–38
7
LIST OF FIGURES
Figure 4.4 Complete Output Window with Bounding Box & EAR Values 36
8
CHAPTER 1
INTRODUCTION
1.1 Introduction
Road accidents have become one of the leading causes of death worldwide. A significant percentage of these
accidents occur due to driver drowsiness, delayed human reactions, distracted driving, and fatigue. With the
rapid increase in automobile usage, ensuring road safety has become a major concern.
Artificial Intelligence (AI) offers innovative solutions to this problem by monitoring driver behavior in real
time. This project introduces an AI-Based Road Accident Detection System using drowsiness detection and
alerting through computer vision and eye landmark [Link] 1.1
Every year, millions of accidents occur due to lack of attentiveness on the road. According to global safety
reports, one out of every five accidents happens because the driver falls asleep or becomes fatigued behind
the wheel.
Traditional systems like seatbelt reminders and speed alarms fail to detect human fatigue. Hence, there is a
growing need for intelligent systems that can predict risky situations and prevent accidents before they
occur.
9
FIG1.2
AI-based monitoring systems analyze real-time facial features, eye movement, and driver responsiveness.
These systems are:
Fatigue and drowsiness reduce driver reaction time, impair judgment, and increase the risk of fatal accidents.
The absence of a real-time alert system makes drivers vulnerable during long journeys.
Problem:
“How can we develop a real-time AI-based system that detects driver drowsiness early and prevents road
accidents using timely alerts?”
11
CHAPTER 2
LITERATURE REVIEW
2.1 Introduction
The literature review explores the existing research, theories, and techniques related to driver drowsiness
detection and accident prevention. Many studies confirm that fatigue-related road accidents are rising,
encouraging researchers to develop intelligent, automated systems.
This chapter summarizes earlier methods, their limitations, and how AI and computer vision-based solutions
have improved accuracy and reliability.
FIG 2.1
Different approaches have been used historically to detect driver fatigue. These can be categorized into three
major types:
a) Physiological-Based Techniques
• EEG (Electroencephalography)
• ECG (Electrocardiography)
• EOG (Electrooculography)
12
These techniques are accurate but intrusive, as the driver must wear sensors, making them uncomfortable for
long use.
b) Vehicle-Based Techniques
Although these techniques are non-invasive, they depend entirely on vehicle movement and fail in good-road
conditions, where the driver can drift without significant steering changes.
This is the most widely adopted and accurate method today. It includes:
• Eye-blink monitoring
• Yawn detection
• Facial expression analysis
• Eye Aspect Ratio (EAR) measurement
Computer vision is low-cost, real-time, and non-intrusive, making it ideal for modern AI systems like yours.
FIG 2.2
The Eye Aspect Ratio (EAR) technique was introduced as a mathematical method to determine eye openness
using 6 eye landmarks.
Advantages of EAR:
• Works in real-time
• Simple and computationally light
• Accurate for detecting micro-sleep events
• Works without training deep learning models
13
Many researchers validated EAR-based models, showing that EAR values drop significantly during
drowsiness.
Dlib’s 68-point facial landmark detector is commonly used to extract the eye region precisely.
Your project addresses these by optimizing threshold values and ensuring robustness in normal lighting.
In recent years, researchers have used advanced ML and DL-based models for drowsiness detection.
Some notable methods include:
• Large datasets
• GPU resources
• Long training time
3. Hybrid Models
• EAR-based system is fast, simple, accurate, and works on normal laptops without GPUs.
From the literature surveyed, the following problems still exist in most solutions:
14
Existing Gap How Your Project Addresses It
No emergency alert You plan to add alarm & future alert features
15
CHAPTER 3
PROPOSED SYSTEM
3.1 System Overview
The proposed system is an AI-Based Road Accident Detection System that uses computer vision to detect
driver drowsiness in real time. The solution continuously captures video through a webcam, detects the
driver’s face, identifies the eye regions, and calculates the Eye Aspect Ratio (EAR).
If the EAR remains below a threshold for a predefined duration, the system triggers an alarm to alert the
driver and prevent possible accidents.
FIG 3.1
16
1. Input Module (Camera/Webcam)
Captures real-time video frames of the driver’s face.
2. Face Detection Module
Uses Dlib/OpenCV to detect the driver’s face from video frames.
3. Facial Landmark Detection Module
Extracts 68 landmark points, especially on the eyes.
4. Eye Aspect Ratio Module
Calculates EAR using eye landmark distance formulas.
5. Decision-Making Module
Determines if the driver is drowsy based on EAR threshold.
6. Alert System Module
Triggers an audible alarm to wake the driver.
17
FIG 3.3
Facial landmark detection plays a crucial role in identifying the exact position of the eyes.
The system uses the Dlib 68-point facial landmark predictor, which divides the facial structure into regions:
• Jawline
• Eyebrows
• Nose
• Mouth
• Eyes
Formula:
Decision logic:
Advantages of EAR:
✔ Fast computation
✔ Training-free
✔ Highly accurate for eye blinking and drowsiness
The alarm:
This alerting system is essential for safety, especially on highways and during night driving.
3.7 Summary
The proposed system integrates camera input, facial landmark detection, EAR analysis, and alarm activation
to create a reliable, real-time accident prevention tool.
Its simple design, minimal hardware requirements, and high accuracy make it a practical solution to improve
road safety.
This chapter detailed how each module interacts and contributes to the overall system functionality.
19
CHAPTER 4
To build the AI-based drowsiness detection system, the following hardware components were used:
These components ensure smooth processing of video frames and allow reliable eye tracking.
All libraries were installed using pip, making the system easy to set up and run on any machine.
FIG 4.1
20
The implementation includes several modules working together:
OpenCV and Dlib were used to detect the driver’s face. Dlib’s HOG + Linear SVM face detector provided
accurate detection under various lighting conditions.
Dlib’s 68-point facial landmark predictor identifies key regions of the face. For drowsiness detection, only
12 points (6 per eye) are required.
• drowsiness
• eye closure
• micro-sleep
FIG 4.2
The system checks multiple frames instead of a single reading to avoid false alarms.
21
• If EAR low for 20 consecutive frames → Driver is drowsy
• Alarm is triggered automatically
FIG 4.3
(These will be inserted into your report later as images – I can generate them if you want)
• Face rectangle
• Eye tracking points
22
• EAR value on screen
• Drowsiness status
4.6.3 Advantages
23
• Easy integration with vehicles
4.6.4 Limitations
24
CHAPTER 5: PROPOSED SYSTEM
5.1 Introduction
The Proposed System describes the design and working of the AI-Based Accident Prevention System
developed in this project. This system is designed to reduce road accidents by continuously monitoring the
vehicle’s surroundings and the driver’s behavior using Artificial Intelligence, Machine Learning, cameras,
and sensors. Based on real-time data, the system analyzes risky situations and gives instant warnings to the
driver to prevent accidents.
Unlike traditional safety systems that react only after an accident occurs, the proposed system predicts and
prevents accidents before they happen. It acts as an intelligent assistant for the driver and enhances overall
road safety.
The proposed system is a real-time smart accident prevention model that performs the following tasks:
The system integrates both hardware components (camera, sensors, microcontroller) and software
components (Python, OpenCV, Machine Learning models) to work together efficiently.
1. Data Acquisition
The camera captures live video of the road ahead, while sensors collect distance and motion data.
Driver monitoring data is also collected using the camera.
2. Data Processing
The captured video and sensor data are sent to the processing unit where image processing and
machine learning algorithms are applied.
3. Object Detection and Analysis
The system detects:
o Moving and stationary vehicles
o Pedestrians
o Road obstacles
o Lane markings
25
o Driver face and eye movements
Deep learning algorithms like YOLO and CNN are used for object detection and
classification.
4. Risk Prediction
The system predicts dangerous situations such as:
o Possible collisions
o Unsafe distance between vehicles
o Sudden lane changes
o Driver drowsiness or distraction
5. Alert Generation
If any unsafe condition is detected, the system immediately provides:
o Audio alerts using a buzzer
o Visual alerts on the display screen
o Optional mobile notification
6. Driver Response
The driver receives the alert and takes immediate action to avoid accidents.
1. Camera Module
2. Sensor Unit
3. Processing Unit
5. Alert Mechanism
26
5.5 Features of the Proposed System
5.8 Summary
In this chapter, the design and working of the AI-Based Accident Prevention System have been explained.
The proposed system uses cameras, sensors, and Artificial Intelligence to monitor the driving environment in
real time. By detecting risky situations early and providing instant alerts, the system helps in preventing
accidents and saving lives.
27
CHAPTER 6
SYSTEM ARCHITECTURE
6.1 Introduction
System Architecture defines the overall structure of the system, showing how different hardware and
software components interact with each other to perform the desired operations. In this project, the
architecture of the AI-Based Accident Prevention System is designed to ensure smooth data collection, fast
processing, accurate decision-making, and immediate alert generation.
1. Input Layer
2. Processing Layer
3. Output Layer
This layered architecture helps in easy implementation, maintenance, and future upgrades.
This flow ensures real-time monitoring and quick response to prevent accidents.
The Input Layer is responsible for collecting real-time data from the environment and the driver. It consists
of the following components:
1. Camera Module
2. Ultrasonic / IR Sensors
28
3. GPS Module (Optional)
All these input devices continuously send data to the processing layer.
The Processing Layer is the core of the system, where all intelligent operations are performed. It consists of
both hardware and software components.
1. Processing Hardware
2. Software Components
29
6.5 Output Layer
The Output Layer is responsible for informing the driver about dangerous situations through different alert
methods.
2. Display Unit
The output layer ensures quick communication between the system and the driver.
This continuous cycle runs in real time and ensures constant safety monitoring.
(If you want, I can also draw a neat architecture diagram for you.)
30
6.8 Benefits of the System Architecture
6.9 Summary
In this chapter, the System Architecture of the AI-Based Accident Prevention System has been explained.
The architecture follows a layered approach consisting of Input Layer, Processing Layer, and Output Layer.
This structured design ensures efficient data collection, intelligent processing using AI, and timely alert
generation to prevent road accidents.
31
CHAPTER 7
HARDWARE REQUIREMENTS
7.1 Introduction
Hardware components play a vital role in the successful implementation of the AI-Based Accident
Prevention System. These components are responsible for collecting real-time data from the vehicle
environment, processing that data, and generating alerts. The proper selection of hardware ensures accuracy,
reliability, and real-time performance of the system. This chapter explains all the hardware used in the
project along with their functions.
1. Camera Module
2. Ultrasonic Sensors
3. Processing Unit (Raspberry Pi / Laptop / Microcontroller)
4. GPS Module (Optional)
5. Buzzer / Alarm
6. Display Unit (Optional)
7. Power Supply Unit
8. Connecting Wires and Mounting Accessories
The camera module is one of the most important components of the system. It is used to capture real-time
video of:
Advantages:
32
7.4 Ultrasonic Sensor
The ultrasonic sensor is used to measure the distance between the vehicle and nearby objects. It works on the
principle of echo reflection of sound waves.
Working Principle:
Functions:
Advantages:
• Low cost
• Accurate for short-range detection
• Works in low-light conditions
The processing unit is the brain of the system. It processes all data received from the camera and sensors and
runs the AI algorithms.
It can be:
• Raspberry Pi
• Laptop/Computer
• Microcontroller (Arduino with AI support)
Functions:
Advantages:
• High-speed processing
• Supports real-time computation
• Easy to program and modify
33
7.6 GPS Module (Optional)
Functions:
Advantages:
The buzzer is used to generate sound alerts to warn the driver during dangerous situations.
Functions:
Advantages:
Functions:
The power supply unit provides electrical power to all hardware components.
Functions:
Advantages:
They include:
• Jumper wires
• Breadboard
• Mounting frames
• Connectors
METHODOLOGY
9.1 Introduction
The methodology describes the step-by-step procedure followed to design, develop, and implement the AI-
Based Accident Prevention System. It explains how data is collected, how it is processed using Artificial
Intelligence and Machine Learning techniques, and how the final system generates alerts to prevent
accidents. A proper methodology ensures that the system works efficiently, accurately, and in real time.
1. Data Acquisition
2. Data Preprocessing
3. Feature Extraction
4. Model Training
5. Real-Time Detection
6. Risk Analysis
7. Alert Generation
8. System Evaluation
Each stage plays an important role in building a reliable accident prevention system.
Data acquisition is the first step of the methodology. In this stage, real-time data is collected from different
sources:
This data provides the raw input required for further processing and analysis.
The raw data obtained from cameras and sensors may contain noise and unwanted information. Therefore,
data preprocessing is required to improve system accuracy.
This step ensures clean and high-quality data for the AI models.
Feature extraction is the process of identifying important patterns from the input data.
These extracted features are used as input for machine learning models.
In this stage, suitable machine learning and deep learning models are selected and trained.
Training Process:
37
9.7 Real-Time Detection
In this stage, the system analyzes all detection results to identify dangerous situations, such as:
If any of these risk conditions are observed, the system immediately makes a decision that the situation is
unsafe.
These alerts inform the driver instantly so that immediate corrective action can be taken.
• Accuracy
• Response time
• False alert rate
• System reliability
9.12 Summary
In this chapter, the methodology of the AI-Based Accident Prevention System has been explained in detail.
It includes data collection, preprocessing, feature extraction, model training, real-time detection, risk
analysis, and alert generation. This systematic methodology ensures that the system functions accurately,
efficiently, and in real time to prevent road accidents.
39
CHAPTER 10
10.1 Conclusion
Road safety is a major concern across the world, and driver drowsiness is one of the leading causes of severe
highway accidents. The system developed in this project successfully addresses this issue by implementing
an AI-Based Road Accident Detection System that identifies early signs of drowsiness using Eye Aspect
Ratio (EAR) and triggers an audible alert to prevent accidents.
The project utilizes OpenCV, Dlib, and Python libraries to process real-time video frames and detect eye
movement. The EAR-based approach has proven to be efficient, low-cost, and easy to implement, making it
suitable for commercial as well as personal use.
The results show that the system performs reliably under normal lighting and typical driving conditions. It
achieves high accuracy in detecting eye closure duration and triggers an alarm at appropriate times to alert
the driver. Although the system faces limitations under low lighting or with sunglasses, it still provides a
strong foundation for improving driver safety through AI.
Overall, the project demonstrates a functional, real-time, intelligent accident prevention tool that can be
further enhanced with more advanced AI features.
10.2 Limitations
Although the system performs effectively in most scenarios, it still has certain limitations:
The accuracy reduces significantly in low-light environments because the webcam struggles to capture clear
eye landmarks.
Dark or reflective sunglasses block the eye region, making EAR calculation impossible.
The system works for one person at a time and cannot detect drowsiness for multiple occupants.
The system only detects drowsiness, not other risky behaviors like looking away, using a phone, yawning, or
head tilting.
40
10.2.5 No Vehicle Integration
Currently, the system is PC/webcam-based and not integrated with actual vehicle hardware or sensors.
The system developed in this project has tremendous potential for enhancement. Some future improvements
include:
Connecting the system with GPS, accelerometer, OBD-II sensors, and vehicle ECU can help detect sudden
braking, skidding, or collisions.
Adding modules to detect accidents using accelerometer + camera data, and automatically sending
Emergency SMS/Call to:
• Ambulance
• Police
• Family members
• Yawning
• Head nodding
• Phone distraction
• Eye closure patterns
Using infrared camera sensors will improve performance significantly in nighttime driving.
The system can be converted into a smartphone-based driver safety app that works on Android or iOS
devices.
• Eye tracking
• Heart rate monitoring
41
• Steering pattern analysis
• Voice detection
Together to detect fatigue more accurately.
42