Professional Documents
Culture Documents
Major Project submitted in partial fulfillment of the requirement for the award of the
degree of
BACHELOR OF TECHNOLOGY
IN
By
G.V.MYTHILI (20R11A0517)
AFIFA NILOUFER (20R11A0503)
B.V.V. SURYA VINAY (20R11A0507)
April-2024
Geethanjali College of Engineering & Technology
(UGC Autonomous)
(Affiliated to JNTUH, Approved by AICTE, New Delhi)
Cheeryal (V), Keesara(M), Medchal Dist.-501 301.
CERTIFICATE
External Examiner
Geethanjali College of Engineering & Technology
(UGC Autonomous)
(Affiliated to JNTUH Approved by AICTE, New Delhi)
Cheeryal (V), Keesara(M), Medchal Dist.-501 301.
G.V.MYTHLI (20R11a0517),
AFIFA NILOUFER(20R11A0503),
B.V.V.SURYA VINAY (20R11A0507),
Department of CSE, Geethanjali College of Engineering and Technology,Cheeryal.
ACKNOWLEDGEMENT
We would like to express our sincere thanks to Dr. A. Sree Lakshmi, Professor, Head of
Department of Computer Science, Geethanjali College of Engineering and Technology,
Cheeryal, whose motivation in the field of software development has made us to overcome
all hardships during the course of study and successful completion of project.
We would like to express our profound sense of gratitude to all for having helped us in
completing this dissertation. We would like to express our deep felt gratitude and sincere
thanks to our guide Mrs. Madhuri Gupta, Associate Professor, Department of Computer
Science, Geethanjali College of Engineering and Technology, Cheeryal, for her skillful
guidance, timely suggestions and encouragement in completing this project.
We would like to express our sincere gratitude to our Principal Prof. Dr. S. Udaya Kumar
for providing the necessary infrastructure to complete our project. We are also thankful to
our Secretary Mr.G.R. Ravinder Reddy for providing an interdisciplinary & progressive
environment.
Finally, we would like to express our heartfelt thanks to our parents who were very
supportive both financially and mentally and for their encouragement to achieve our set
goals.
G.V. MYTHILI(20R11A0517),
AFIFA NILOUFER(20R11A0503),
B.V.V.SURYA VINAY(20R11A0507).
i
ii
ABSTRACT
This major project endeavors to design and implement an advanced helmet detection
system utilizing the YOLOv8 (You Only Look Once version 8) object detection
framework. The primary objective is to enhance road safety by detecting non-compliant
helmet usage among bike and cycle riders in various road environments.
The project initiates with the collection of a diverse dataset comprising images captured
from different road scenarios. These images are meticulously annotated using LabelImg,
with bounding boxes delineating the presence of helmets on bike and cycle riders.
Concurrently, YAML files are generated to organize the dataset and specify the paths to the
annotated images.
Subsequently, the annotated dataset is utilized to train the YOLOv8 model, leveraging
transfer learning techniques to adapt the pre-trained model to the task of helmet detection.
The training process involves optimizing the model's parameters based on annotated
examples, with a focus on achieving high accuracy and robustness in real-world scenarios.
The YOLO model can identify all the objects involved in the input image by passing the
image through a single convolutional neural network only once. The model does not
identify the potential object locations using a neural network and then use another neural
network to detect if an object is present in all the predicted areas.
So YOLO is very quick compared to other computer vision models. The effective
architecture of the model allows us to perform real-time detections. So we are using the
YOLO model for helmet detection in our project.
The anticipated outcomes of this major project include the development of a reliable and
efficient helmet detection system capable of real-time deployment for road safety
monitoring. The system is expected to provide valuable insights for law enforcement
agencies, policymakers, and transportation authorities, aiding in the enforcement of helmet
usage regulations and the reduction of head injuries among bike riders.
iii
LIST OF FIGURES
1 YOLOV8 Architecture 17
2 System Architecture 18
4 Class Diagram 21
6 Activity Diagram 24
8 Dataset 28
11 Output Screen-1 37
12 Output Screen-2 37
13 Output Screen-3 38
14 Output Screen-4 38
15 Plagiarism checker 45
iv
LIST OF TABLES
1 Test cases 35
v
LIST OF ABBREVIATIONS
1 ML Machine Learning
vi
TABLE OF CONTENTS
1.2 Objective 2
2. System Analysis
2.3.1 Details 4
2.3.3 Safety 4
2.3.4 Ethics 5
2.3.5 Cost 5
2.3.6 Type 5
vii
2.5 Modules 7
3. Literature Overview 9
4. System Design
5. Implementation
5.1 Implementation 30
6. Testing
6.1 Testing 35
7. Output Screens 37
8. Conclusion
viii
8.1 Conclusion 39
9. Bibliography
10 Appendices
A. SW used 43
B. Methodologies used 43
11 Plagiarism Report 45
ix
1.INTRODUCTION
The project initiates by ingesting video footage depicting road scenes, serving as its
primary input. This footage captures the dynamic and diverse environment of a road,
showcasing various scenarios encountered by motorcyclists. Through meticulous
processing and analysis, the project endeavors to enhance road safety by discerning
instances of helmet usage among motorcyclists, a pivotal aspect in mitigating head
injuries during potential accidents.
Utilizing cutting-edge deep learning techniques, the YOLO model is deployed as the
cornerstone for helmet detection within the project framework. The model operates
dynamically, scanning each frame of the video feed with precision and speed,
identifying motorcyclists within the scene. Upon detection, the model meticulously
evaluates each motorcyclist's head region, discerning whether a helmet is present or
absent with utmost accuracy.
In the resulting output video, each motorcyclist recognized by the YOLO model is
distinctly marked with a bounding box, elegantly encompassing their presence within
the scene. Moreover, within these bounding boxes, an informative annotation is
included, succinctly denoting the model's determination: whether the motorcyclist is
wearing a helmet or not. This amalgamation of visual cues and textual annotations
provides viewers with a comprehensive understanding of the helmet compliance status
for each motorcyclist observed in the video feed.
1
Furthermore, accompanying each bounding box annotation is a confidence level,
serving as a measure of the model's certainty regarding its helmet detection. This metric
offers valuable insights into the reliability of the detection process, aiding viewers and
stakeholders in assessing the robustness of the system's performance.
1.2 OBJECTIVE
The primary goal of this project is to develop a robust system capable of real-time
helmet detection when provided with live footage of road scenes captured by CCTV
cameras. Leveraging the YOLO model, the system dynamically analyzes each frame,
swiftly identifying motorcyclists and discerning whether they are wearing helmets or
not. This real-time capability is crucial for enabling prompt intervention and ensuring
adherence to helmet regulations, thereby enhancing road safety measures.
A Efforts are also directed towards establishing a seamless pipeline for real-time
monitoring and analysis of helmet compliance on roadways. By processing live CCTV
footage with minimal latency, the system enables prompt identification of non-
compliant motorcyclists, empowering authorities to intervene swiftly and mitigate
potential safety risks. This integration with existing surveillance infrastructure
streamlines the deployment and scalability of helmet compliance monitoring efforts
across diverse road environments.
2
2. SYSTEM ANALYSIS
In this section, we delve into the analysis of both the existing system and the proposed
system, followed by a feasibility study encompassing various aspects such as
environmental impact and safety considerations.
The current state of helmet detection systems for monitoring road safety often relies on
manual observation or static surveillance cameras. These methods lack the ability to
provide real-time insights and are susceptible to human error. Manual observation is
labor-intensive and prone to inconsistencies, while static surveillance cameras offer
limited coverage and cannot adapt to dynamic road environments effectively.
Consequently, existing systems fall short in ensuring comprehensive and timely
monitoring of helmet compliance among motorcyclists.
In contrast, the proposed system aims to revolutionize helmet detection for road safety
through the integration of advanced computer vision techniques and real-time analysis
capabilities. Leveraging the YOLOv8 (You Only Look Once version 8) object detection
framework, the system can dynamically analyze live footage from CCTV cameras. This
approach allows for swift identification of motorcyclists and precise detection of
helmets in real-time. Upon detection, the system annotates the video feed with
bounding boxes around the detected helmets. Additionally, each annotation includes a
label indicating whether the motorcyclist is wearing a helmet ("helmet ") or not ("no
helmet"), accompanied by a confidence level. This comprehensive approach not only
enhances the accuracy and efficiency of helmet detection but also enables prompt
intervention and enforcement measures, thereby significantly improving road safety
outcomes.
3
2.3 FEASIBILITY STUDY
2.3.1 DETAILS
2.3.3 SAFETY
The system's safety is further bolstered by its limited interaction with external devices
and its lack of access to collect or store sensitive information. As it operates
independently without the need for external connections, the probability of a
cyberattack is significantly reduced. Additionally, since the system does not produce
4
sensitive data, there is minimal risk of compromising user privacy or security.
Consequently, the system can be considered highly safe to use, providing users with
peace of mind regarding potential cybersecurity threats.
2.3.4 ETHICS
The system's ethical integrity is upheld by its limited interaction with external devices
and its stringent data handling policies. As it does not interact with external devices, nor
does it collect, store, or produce sensitive data, the likelihood of ethical clashes is
negligible. This design ensures that user privacy and data security are upheld,
mitigating concerns regarding potential ethical dilemmas. By prioritizing user
confidentiality and data protection, the system demonstrates a commitment to ethical
principles, fostering trust and accountability in its utilization.
2.3.5 COST
The system's cost-effectiveness is notable, as it relies solely on Python and its requisite
modules. Installation expenses are virtually nonexistent, given that Python is an open-
source programming language. Moreover, the system incurs no direct costs for its
installation, making it accessible to a wide range of users. While Wi-Fi connectivity is
necessary during the initial setup for installing Python and the required modules,
ongoing operational costs are minimal. This affordability enhances the system's
accessibility and scalability, ensuring that cost constraints do not impede its adoption
and deployment.
2.3.6 TYPE
5
leveraging open-source technologies, the system maintains flexibility and accessibility
for users across various platforms.
2.4 SCOPE
The project's scope extends beyond helmet detection to include the identification of
motorcyclists and subsequent integration with a number plate detection system. Once
the helmet detection phase is completed and motorcyclists are identified, the system
will proceed to identify the associated motorcycles.
Once the number plate information is obtained, the system will utilize it to
automatically generate and issue traffic violation notices, commonly known as challans.
These notices will be sent directly to the respective individuals via messages, notifying
them of any detected violations.
This holistic approach not only enhances road safety through helmet compliance
monitoring but also enables efficient enforcement of traffic regulations by automating
the detection and issuance of challans for violations such as riding without a helmet or
improper number plate display. By seamlessly integrating multiple components, the
project aims to streamline the enforcement process, thereby contributing to improved
road safety and compliance with traffic laws.
6
2.5 MODULES
In the project, several modules are essential for its successful implementation. Two key
modules include the YOLO module for object detection and the display module for
visualizing the output.
The YOLO module plays a crucial role in detecting objects, particularly helmets and
motorcyclists, within the video footage. It utilizes the YOLOv8 object detection
framework, which is renowned for its accuracy and efficiency in real-time object
detection tasks. This module is responsible for processing each frame of the video feed,
identifying motorcyclists, and discerning whether they are wearing helmets.
On the other hand, the display module is responsible for visualizing the output of the
helmet detection system. It facilitates the annotation of the video feed with bounding
boxes around detected helmets and motorcyclists, as well as annotations indicating
"helmet wearing" or "no helmet" along with confidence levels. Additionally, the display
module ensures the seamless presentation of the output in a user-friendly format,
enabling stakeholders to easily interpret the results.
Hardware Requirements
Software Requirements
8
3. LITERATURE OVERVIEW
3.1 Real-time Traffic Monitoring System based on Deep Learning and YOLOv8
Article in ARO [The Scientific Journal of Koya University- November 2023]
Link:https://www.researchgate.net/publication/375675748_Real-
time_Traffic_Monitoring_System_based_on_Deep_Learning_and_YOLOv8
9
3.2 Object detection using YOLO: challenges, architectural successors, datasets
10
Link : https://link.springer.com/article/10.1007/s11042-022-13644-y
Link: https://ieeexplore.ieee.org/document/10408800
11
3.4 Real-Time Multi-Class Helmet Violation Detection Using Few-Shot Data Sampling
Technique and YOLOv8[Armstrong Aboah, Bin Wang, Ulas Bagci, Yaw Adu-Gyamfi]
Traffic safety is a major global concern. Helmet usage is a key factor in preventing head
injuries and fatalities caused by motorcycle accidents. However, helmet usage
violations continue to be a significant problem. To identify such violations, automatic
helmet detection systems have been proposed and implemented using computer vision
techniques. Real-time implementation of such systems is crucial for traffic surveillance
and enforcement, however, most of these systems are not real-time. This study proposes
a robust real-time helmet violation detection system. The proposed system utilizes a
unique data processing strategy, referred to as few-shot data sampling, to develop a
robust model with fewer annotations, and a single-stage object detection model,
YOLOv8 (You Only Look Once Version 8), for detecting helmet violations in real-time
from video frames. Our proposed method won 7th place in the 2023 AI City Challenge,
Track 5, with an mAP score of 0.5861 on experimental validation data. The
experimental results demonstrate the effectiveness, efficiency, and robustness of the
proposed system.
Link : https://ieeexplore.ieee.org/document/10208778
12
3.5 Safety Helmet Detection Using YOLO V8 [Krunal Patel, Vrajesh Patel, Vikrant
Prajapati, Darshak Chauhan, Adil Haji]
Ensuring safety in the workplace is crucial to the wellbeing of workers and the success
of organizations. One essential aspect of workplace safety is the use of safety helmets in
hazardous environments. Safety helmets protect workers from head injuries caused by
falling objects, electric shocks, and other hazards. In recent years, computer vision-
based safety helmet detection systems have gained popularity as a means of ensuring
compliance with safety regulations and reducing accidents. This study proposes a safety
helmet detection system based on the You Only Look Once (YOLO) V8 algorithm,
which is a state-of-the-art object detection algorithm that has shown superior
performance in detecting small objects in real-time. The proposed system involves
training the YOLO V8 algorithm on a dataset of images containing workers with and
without safety helmets. The dataset was carefully curated to include various lighting
conditions, camera angles, and helmet types. The trained model was then evaluated on a
separate test set to measure its performance. Experimental results demonstrate that the
proposed approach achieves high accuracy in detecting safety helmets, with an average
precision of 0.99 and a recall of 0.99. The model also demonstrated robustness to
variations in lighting and camera angles, making it suitable for real-world deployment.
Link: https://ieeexplore.ieee.org/abstract/document/10266244
13
3.6 Real-Time Flying Object Detection with YOLOv8[Dillon Reis, Jordan Kupec,
Jacqueline Hong, Ahmad Daoudi]
This paper presents a generalized model for real-time detection of flying objects that can be
used for transfer learning and further research, as well as a refined model that is ready for
implementation. We achieve this by training our first generalized model on a data set
containing 40 different classes of flying objects, forcing the model to extract abstract
feature representations. We then perform transfer learning with these learned parameters on
a data set more representative of real world environments (i.e., higher frequency of
occlusion, small spatial sizes, rotations, etc.) to generate our refined model. Object
detection of flying objects remains challenging due to large variance object spatial
sizes/aspect ratios, rate of speed, occlusion, and clustered backgrounds. To address some of
the presented challenges while simultaneously maximizing performance, we utilize the
current state of the art single-shot detector, YOLOv8, in an attempt to find the best tradeoff
between inference speed and mAP. While YOLOv8 is being regarded as the new state-of-
the-art, an official paper has not been provided. Thus, we provide an in-depth explanation
of the new architecture and functionality that YOLOv8 has adapted. Our final generalized
model achieves an mAP50-95 of 0.685 and average inference speed on 1080p videos of 50
fps. Our final refined model maintains this inference speed and achieves an improved
mAP50-95 of 0.835.
Link: https://arxiv.org/abs/2305.09972
14
3.7 You Only Look Once: Unified, Real-Time Object Detection [Joseph Redmon, Santosh
Divvala, Ross Girshick, Ali Farhadi]
Humans glance at an image and instantly know what objects are in the image, where they
are, and how they interact. The human visual system is fast and accurate, allowing us to
perform complex tasks like driving with little conscious thought. Fast, accurate algorithms
for object detection would allow computers to drive cars without specialized sensors,
enable assistive devices to convey real-time scene information to human users, and unlock
the potential for general purpose, responsive robotic systems. Current detection systems
repurpose classifiers to perform detection. To detect an object, these systems take a
classifier for that object and evaluate it at various locations and scales in a test image.
Systems like deformable parts models (DPM) use a sliding window approach where the
classifier is run at evenly spaced locations over the entire image.
Link : https://arxiv.org/abs/1506.02640
15
3.8 A Comprehensive Review Of YOLO: From YOLOV1 TO YOLOV8 And Beyond
[Under Review In ACM Computing Surveys]
Link : https://arxiv.org/pdf/2304.00501v1
16
4. SYSTEM DESIGN
You Only Look Once (YOLOv8) proposes using an end-to-end neural network that
makes predictions of bounding boxes and class probabilities all at once. It differs from
the approach taken by previous object detection algorithms, which repurposed
classifiers to perform detection.
17
4.1.2 System Architecture
In our project, the input to the model is a traffic video, which serves as a real-world
representation of road scenes captured by CCTV cameras. This video stream is passed
through the YOLOv8 (You Only Look Once version 8) model, which has been
meticulously trained to recognize objects of interest, specifically helmets and non-
helmet objects. The YOLOv8 model performs real-time object detection, swiftly
analyzing each frame of the video feed.
18
During the object detection process, the YOLOv8 model identifies and marks the
detected objects with their respective classes, such as "helmet" or "no helmet."
Additionally, the model provides the probability scores associated with each detected
object, indicating the likelihood of it belonging to a particular class. This nuanced
analysis allows for precise determination of whether a person is wearing a helmet or
not, providing valuable insights into compliance with safety regulations.
The display system plays a pivotal role in presenting the results obtained from the
YOLOv8 model. Continuously capturing frames from the traffic video, the display
system feeds each frame into the YOLOv8 model for real-time evaluation.
Subsequently, the results generated by the model are presented on the screen in a clear
and intuitive manner. This seamless integration of the display system with the YOLOv8
model enables continuous monitoring and evaluation of helmet compliance among
individuals depicted in the traffic video.
19
4.2 UML DIAGRAMS
The use case diagram for the helmet detection system illustrates the sequential steps
involved in its operation. Initially, the user opens the application, initiating the process.
Subsequently, they upload a traffic video to be analyzed for helmet detection. Once the
video is uploaded, the system begins to extract features by training the YOLOv8 model
with a dataset containing labeled images of helmets and non-helmet objects. This
training process enables the model to learn and recognize relevant features necessary
for accurate helmet detection.
Following the training phase, the system proceeds to analyze each frame of the
uploaded video, determining whether individuals depicted are wearing helmets or not.
20
This analysis involves processing the video frames through the trained YOLOv8 model,
which assigns confidence scores to each detection, indicating the likelihood of helmet
presence. Finally, the results of the helmet detection analysis are displayed to the user,
typically in the form of annotated video frames showcasing helmet-wearing status and
associated confidence levels. This comprehensive approach enables users to effectively
monitor and assess helmet compliance in traffic videos, contributing to improved road
safety measures.
Firstly, the ‘LaptopUser’ class encapsulates the attributes and methods related to the
user's interaction with the system. It includes a method to generate a unique laptop ID
and a method for initiating the helmet detection process.
21
Next, the ‘DetectionSystem’ class serves as the core component responsible for
capturing videos and performing helmet detection. Within this class, the Webcam
attribute represents the webcam used for capturing video footage. It contains methods
for capturing videos from the webcam and implementing helmet detection algorithms.
Lastly, the ‘DecisionSystem’ class handles the final decision-making process based on
the helmet analysis results. It contains methods for determining whether a helmet is
present or not based on the analyzed features. These methods enable the system to
classify detected objects as either helmet or no helmet, providing valuable insights for
safety enforcement measures.
Overall, the class diagram outlines the key components and interactions within the
helmet detection system, facilitating the seamless analysis of video footage to ensure
compliance with helmet safety regulations.
22
4.2.3 STATE CHART DIAGRAM
The state chart diagram for the helmet detection system outlines the sequential stages
involved in processing video data for helmet detection. It begins with the "Load Model"
state, where the system initializes and loads the pre-trained YOLOv8 model architecture
, essential for subsequent processing. Once the model is loaded, the system transitions
to the "Train with Dataset" state, where it refines the model's performance by training it
with a labeled dataset containing images of helmets and non-helmet objects. This
training process allows the model to learn and adapt to the specific characteristics of
helmet detection.
23
After training with the dataset, the system progresses to the "Pass Video" state, where it
receives the input video stream for analysis. This stage involves the continuous flow of
video frames through the system for real-time processing. As the video stream is passed
through the model, the system enters the "Extract Frames" state, where individual
frames are extracted for further analysis.
Subsequently, in the "Detect" state, the system performs helmet detection on each
extracted frame using the trained YOLOv8 model. This stage involves analyzing each
frame to identify and localize instances of helmets within the video stream. Following
helmet detection, the system transitions to the "Decision" state, where it evaluates the
detected objects and makes decisions based on predefined criteria.
Finally, in the "Display" state, the system presents the analyzed results to the user,
typically in the form of annotated video frames highlighting detected helmets. This
stage involves visualizing the analysis outcomes, allowing users to review and interpret
the detected objects and their associated attributes.
24
The data required for training the model is prepared. This dataset is pre-processed by
marking the images with the required labels(helmet, nohelmet) using the open source
labelImg tool . This dataset is used for training the model . After every iteration of
training the model is evaluated and is improvised in the next iteration for about 100
epochs .This trained model is stored and used for making predictions .
25
4.3 SYSTEM DESIGN
Yolo Module
The YOLO (You Only Look Once) module is integral to our helmet detection system,
serving as the backbone for real-time object detection tasks. YOLOv8, specifically, is
employed due to its efficiency and accuracy in detecting helmets within traffic videos.
This module encompasses the architecture, implementation, and fine-tuning of the
YOLOv8 model. It includes functionalities for loading the model architecture,
initializing weights, and executing object detection on video frames. Additionally, the
YOLO module incorporates techniques such as anchor boxes, feature pyramid networks
(FPNs), and skip connections to optimize detection performance. Through modular
design, the YOLO module ensures flexibility, scalability, and maintainability of the
object detection pipeline.
Display Module
The Display module is responsible for visualizing the results of helmet detection
analysis to users in a clear and intuitive manner. It includes components for rendering
video frames with annotations indicating detected helmets, confidence scores, and
classification results. The Display module facilitates seamless interaction with the
analysis outcomes, allowing users to review, interpret, and take appropriate actions
based on the detected objects. Furthermore, the Display module ensures compatibility
with various display devices and interfaces, enhancing user accessibility and usability.
Through modular design, the Display module promotes modifiability and extensibility,
enabling easy integration with other system components and potential future
enhancements.
26
4.3.2 DATABASE DESIGN
In the database design for the helmet detection system, the focus is on organizing the
structure to efficiently handle and manage the various data entities involved. The design
includes entities such as users, videos, frames, detected objects, and analysis results,
each serving a specific purpose within the system.
The user entity represents individuals interacting with the system, and it includes
attributes like username, email, and password for user authentication and access control.
Videos uploaded to the system are stored with attributes such as video ID and path,
allowing for the tracking and management of video data.
Frames extracted from the uploaded videos are stored as entities with attributes like
frame number and image data. These frames serve as the basis for object detection and
analysis within the system. Detected objects, such as helmets, are represented with
attributes describing their class labels, confidence scores, and bounding box coordinates
within the frames.
The analysis results entity stores the outcomes of helmet detection for each frame,
indicating whether a helmet is detected and the associated confidence level. These
results enable users to review and interpret the system's performance in detecting
helmets accurately.
Relationships between entities are established based on their interactions within the
system, although no explicit keys are utilized. Instead, the relationships are implied
based on the connections between entities and their attributes. This simplified approach
to database design allows for a straightforward organization of data entities without the
need for complex key structures.
27
4.3.2.1 Preparation Of Dataset Using LabelImg
28
4.3.2.3 Coordinates For Helmet_0 Image
29
5. IMPLEMENTATION
The project's implementation begins with accessing files stored in Google Drive, crucial
for dataset management and model storage. By mounting Google Drive within the
Colab environment, seamless access to dataset files and trained model weights is
ensured, facilitating efficient model training and inference processes.
Subsequently, the dataset required for training and testing the helmet detection model is
downloaded and extracted into a designated directory. This dataset likely contains
images or videos capturing various traffic scenes, with annotations specifying the
presence or absence of helmets. This step ensures that the model is trained on diverse
and representative data, enhancing its ability to generalize and accurately detect helmets
in real-world scenarios.
Once the dataset is prepared, the YOLOv8 model is trained using the dataset with
specified parameters such as the number of epochs and image size. Training the model
involves optimizing its parameters to learn and recognize patterns associated with
helmet presence within the provided images or videos. This phase is critical for the
model to achieve high accuracy and robustness in helmet detection.
After training, the model is loaded for inference, where it is applied to a video source to
detect helmets in real-time. The results of the helmet detection process are then
visualized and analyzed, allowing users to evaluate the system's performance and
accuracy. This step is essential for assessing the model's effectiveness in identifying
helmets within the video stream, providing valuable insights for further optimization
and improvement.
30
Additionally, preprocessing of video data is performed using OpenCV, a popular
computer vision library. Frames from the specified video source are captured, resized,
displayed for visual inspection, and saved to disk for further analysis. This
preprocessing step ensures that the video data is appropriately formatted and processed
for accurate helmet detection, contributing to the overall effectiveness of the system.
Img.py
import cv2
import time
cpt = 0
maxFrames = 100
count=0
cap=cv2.VideoCapture('2wheelertraffic.webm')
frame=cv2.resize(frame,(1080,500))
time.sleep(0.01)
cv2.imwrite(r"C:\Users\surya\Downloads\yolov8helmetdetection-main\
yolov8helmetdetection-main\images\helmet_%d.jpg" %cpt, frame)
cpt += 1
if cv2.waitKey(5)&0xFF==27:
break
cap.release()
cv2.destroyAllWindows()
main.py
import os
HOME = os.getcwd()
print(HOME)
import ultralytics
ultralytics.checks()
32
from IPython.display import display, Image
drive.mount('/content/gdrive')
!ls /mydrive
!mkdir {HOME}/datasets
%cd {HOME}/datasets
!unzip /content/gdrive/MyDrive/MajorProjectNew.zip
%cd {HOME}
%cd {HOME}
Data.yml
nc: 2
33
driver.py
model=YOLO('bestNew.pt')
source = '2wheelertraffic.webm'
34
6.TESTING
6.1 TESTING
Testing includes running the python code multiple times, but each time we test different
aspects of the code in the real time scenario. The parameters of the project are checked
individually until all are relatively cohesive. After this all the code is integrated into a
single code, as we keep combining the codes, we perform integration testing when we
have successfully established unit testing on smaller parts of the code. Testing plays a
huge role in our project because our entire project's efficiency depends on the accuracy
of the output, the more accurate the output the better the project.
36
7. OUTPUT SCREENS
37
7.3 Output Screen 3
38
8.CONCLUSION
8.1 CONCLUSION
The project has made significant progress in developing a robust helmet detection
system using the YOLOv8 model. Through meticulous dataset preparation, model
training, and implementation of detection algorithms, the system demonstrates
promising capabilities in accurately identifying individuals wearing helmets in various
real-world scenarios.
With successful training and testing phases, the model showcases its ability to handle
diverse challenges such as varied lighting conditions, different camera perspectives, and
the presence of multiple vehicles. This ensures that the system can effectively
contribute to road safety measures by providing reliable helmet detection capabilities.
Moving forward, the project aims to further refine the model's performance, optimize
computational efficiency, and enhance the user interface for seamless integration into
real-time monitoring systems. Additionally, ongoing evaluation and validation efforts
will continue to assess the system's accuracy and reliability across diverse datasets and
scenarios.
In conclusion, the progress achieved thus far underscores the project's potential to make
a significant impact on road safety initiatives by providing an advanced helmet
detection solution. With continued development and refinement, the system is poised to
become a valuable tool in promoting safer road practices and reducing the risks
associated with inadequate helmet usage.
39
8.2 FURTHER ENHANCEMENTS
Further enhancements to the project could significantly bolster its effectiveness and
usability in promoting road safety through improved helmet detection capabilities. One
avenue for enhancement lies in optimizing the YOLOv8 model to strike a balance
between accuracy and computational efficiency. Techniques such as model
quantization, pruning, or architecture modifications can be explored to streamline
inference speed and reduce computational resource requirements, enabling smoother
real-time operation of the system on edge devices or embedded systems. By enhancing
the model's efficiency, the system can deliver faster and more responsive helmet
detection results, contributing to timely enforcement of helmet usage regulations and
improved safety outcomes on the roads.
Improving the user interface of the system is essential to enhance usability and
accessibility for end-users. A user-friendly interface with intuitive controls, informative
visualizations, and real-time feedback capabilities can streamline system operation and
analysis for users, including traffic authorities, law enforcement agencies, and other
stakeholders. By developing a web-based dashboard or mobile application for remote
monitoring, configuration, and analysis of helmet detection results, the system becomes
more accessible and adaptable to various deployment scenarios and user requirements.
40
Furthermore, establishing a framework for continuous evaluation and improvement of
the system's performance is crucial for its long-term success. Regular retraining of the
model with updated datasets, monitoring of key performance metrics, and solicitation of
feedback from end-users can help identify areas for enhancement and refinement. By
continuously iterating on the system's design and functionality, it can adapt to evolving
road safety challenges and regulatory requirements, ensuring its continued effectiveness
in promoting helmet usage and reducing the incidence of preventable accidents and
injuries on the roads.
41
9. BIBILOGRAPHY
https://docs.ultralytics.com/yolov5
https://www.researchgate.net/publication/375675748_Real-
time_Traffic_Monitoring_System_based_on_Deep_Learning_and_YOLOv8
https://link.springer.com/article/10.1007/s11042-022-13644-y
42
10. APPENDICES
A. SOFTWARE USED
Python
YOLOv8 is the newest state-of-the-art YOLO model that can be used for object
detection, image classification, and instance segmentation tasks. YOLOv8 was
developed by Ultralytics, who also created the influential and industry-defining
YOLOv5 model. YOLOv8 includes numerous architectural and developer experience
changes and improvements over YOLOv5.
LabelImg
Utilized LabelImg, a popular annotation tool, for labeling and annotating datasets.
LabelImg allows for the efficient annotation of images with bounding boxes, which is
essential for training object detection models like YOLOv8. By incorporating LabelImg
into your workflow, you have ensured the availability of accurately labeled data for
training your object detection model, thereby enhancing its performance and
effectiveness.
43
B. METHODOLOGIES USED
The project likely involves collecting a dataset of images or videos containing scenes of
people riding bikes or motorcycles, both with and without helmets. These data serve as
the basis for training and testing the helmet detection model. In the provided code, a
video footage containing traffic scenes is utilized as input for the detection system.
The YOLOv8 model is chosen as the object detection framework for its efficiency and
accuracy. The provided code trains the YOLOv8 model using the collected dataset to
learn the features and patterns associated with helmet presence. The model is trained
with specified parameters such as the number of epochs and image size to optimize its
performance.
The code may involve experimenting with different hyperparameters such as the
learning rate, batch size, and image size to optimize the performance of the YOLOv8
model during training. Fine-tuning these parameters helps improve the model's
accuracy and convergence speed.
Following training, the performance of the trained model is evaluated and validated
using separate test data to assess its accuracy and generalization ability. Metrics such as
precision, recall, and F1 score may be calculated to measure the model's performance.
In the provided code, the model's performance can be visually assessed by running it on
test videos and inspecting the detection results.
Once validated, the trained model can be deployed and integrated into the target
application or system for real-world use. This involves optimizing the model for
inference on different hardware platforms and integrating it with existing software
infrastructure for seamless operation.
44
11.PLAGIARISM REPORT
45