Helmet Detection and Number Plate Recognition Using Deep Learning
Helmet Detection and Number Plate Recognition Using Deep Learning
TENSYMP2022 1570799078
2
3
4
5
6
7
Helmet Detection And Number Plate Recognition
8
9
Using Deep Learning
10
11
Prof. Pushkar Sathe
12
Department of Electronics and Telecommunication
13
Engineering
14
SIES Graduate School of Technology
15
Navi Mumbai, Maharashtra, India
16
[email protected]
Aditi Rao Aditya Singh
17
Department of Electronics and Telecommunication Engineering Department of Electronics and Telecommunication Engineering
18
SIES Graduate School of Technology SIES Graduate School of Technology
19
Navi Mumbai, Maharashtra, India Navi Mumbai, Maharashtra, India
20
[email protected] [email protected]
21
22
Ritika Nair Abhilash Poojary
23
Department of Electronics and Telecommunication Engineering Department of Electronics and Telecommunication Engineering
24
SIES Graduate School of Technology SIES Graduate School of Technology
2022 IEEE Region 10 Symposium (TENSYMP) | 978-1-6654-6658-5/22/$31.00 ©2022 IEEE | DOI: 10.1109/TENSYMP54529.2022.9864462
Authorized licensed use limited to: Zhejiang University. Downloaded on March 03,2025 at 10:30:39 UTC from IEEE Xplore. Restrictions apply.
2
wearing a helmet or not. The first method is to check Metrics in the wandb site show the variation in precision and
overlapping between detected classes. In order to check overlap, loss of our model. Next, we have changed hyperparameters in
we check if the area of intersection between the two boxes is the configuration file according to our custom dataset. After
positive. This is done 3 times, firstly overlapping between saving we proceeded with training. We propose two methods for
Helmet and Person is checked. If overlap exists between finding out whether a person is wearing a helmet or not.
Motorcycle and Number Plate then overlapping between Person
and Motorcycle is checked. Further, it will check for Helmet In method 1, we first detect all four classes - helmet,
coordinates. If helmet coordinates are present then we check for person, motorcycle, and number plate using YOLOv5. Training
overlapping and if it overlaps then the biker is wearing a helmet. the model with a higher batch size requires more GPU.
And if helmet coordinates are not present then the biker is not Therefore, we have kept the batch size value as 8. We kept the
wearing a helmet and we crop the number plates using number learning rate as small as possible (i.e. 0.001) to obtain the best
plate coordinates. This cropped image is then given as input to accuracy at each step size. We observed while training, that the
the EasyOCR model for character recognition. Thus, we obtain mAP of the model, when trained with all four classes, was less
the Number Plate characters of the biker not wearing a helmet. compared to the mAP of the model when trained with two
In the second method, we set a range using motorcycle classes at a time. Thus, we split our models into two - one for
coordinates and check if the helmet coordinates fall inside this detecting helmet and person classes and the other model for
range. If it does, then the biker is wearing a helmet and if it detecting motorcycle and number plates. We trained with
doesn’t then we extract the number plate characters as YOLOv5s weight and finally obtained an mAP value of 0.943
mentioned in the first method. for the Motorcycle and Number plate model, and for Person and
Helmet, we obtained an mAP value of 0.945.
A. Object Detection
After object detection, we get bounding box
1) Collection of Dataset coordinates for all the four classes - helmet, number plate,
motorcycle, and person. YOLOv5 gives the coordinates in
According to the requirements, we decided we needed YOLO format. For making the further process easier, we need
4 classes in total, i.e. Helmet, Number plate, Motorcycle, and to convert these coordinates from YOLO to PASCAL VOC.
Person. We have used 4,000 images in total to train these
classes, 1,000 images for each class. We obtained the images
and their annotation files using the Open Image Dataset (OIDv6)
[13]. For annotating the images we used, makesense.ai[14] and
LabelImg[15] tools. Makesense.ai is a free-to-use online tool
whereas LabelImg is python generated offline tool for labeling
photos. Since we are using the YOLOv5 algorithm we have
obtained the labels in the Yolo format as a “.txt” file.
We also used RoboFlow[16] for pre-processing and
augmenting our dataset to increase the dataset. Once our dataset
was ready, we split it into train-test folders.
Authorized licensed use limited to: Zhejiang University. Downloaded on March 03,2025 at 10:30:39 UTC from IEEE Xplore. Restrictions apply.
3
helmeted rider. To rule out the person being a pedestrian, we based on the height and width of the bounding box and check
would again check the overlap between Person class and whether the helmet coordinates fall inside the coordinate range
Motorcycle class and if it doesn’t overlap, it means it is a regular of the motorcycle. X-coordinates of the helmet will fall inside
pedestrian. If the overlap exists, then this implies that the person the x-coordinate range of the motorcycle whereas the y-
is riding the bike as shown in Figure 3.b. Further for the final coordinates of the helmet will be on an average 40% above the
step, we need to extract its number plate. So again, we check the y-coordinates of the motorcycle according to our dataset. So, by
overlap between the Motorcycle class and Number plate (Figure setting that range we can check whether the y-coordinates of the
3.c). Thus, we have successfully extracted the number plate of helmet fall inside the range as shown using a yellow-colored
those bike riders who are not wearing helmets. shade in Fig.3.d. If it does, it will display “Biker is wearing a
helmet” as output and if it does not, it will display “Biker is not
wearing a helmet” and check for overlapping between
Motorcycle class and Number plate class and extract the
characters from the number plate.
Fig 3.a Checking Overlap between helmet and person class Method 1
Fig 3.d Checking if the helmet is present 40% above the height of the
motorcycle - Method 2
B. Character Recognition
Authorized licensed use limited to: Zhejiang University. Downloaded on March 03,2025 at 10:30:39 UTC from IEEE Xplore. Restrictions apply.
4
In the above experiment, we observed that, as the
number of classes increases, it, in turn, decreases the accuracy In Method 1, we trained two different models with two
of the model. Thus, to tackle this problem, we used 2 models classes each and observed higher accuracy as shown in Fig. 5.
with 2 classes each. Further, we used an overlapping method to check whether the
biker is wearing a helmet or not. Consider Fig. 6.a, there are two
TABLE 1: Mean Average Precision for trained models number plates, two motorcycles, and two people in the same
No. of classes mAP image. Since there are multiple objects of the same class present
in the image, we consider the coordinates of the first motorcycle
4 classes (h,p, np, m) 0.56
and check the overlapping with each number plate. The
overlapping number plate and motorcycle will give a positive
response as “overlap” as shown below in Fig. 6.a.
3 classes (np, m,h) Method 2 0.847
Authorized licensed use limited to: Zhejiang University. Downloaded on March 03,2025 at 10:30:39 UTC from IEEE Xplore. Restrictions apply.
5
[5] K. Dahiya, D. Singh, and C. K. Mohan, “Automatic
detection of bike-riders without helmet using surveillance
videos in real-time,” in 2016 International Joint Conference on
Neural Networks (IJCNN), July 2016.
[6] Fan Wu, Guoquing Jin, “Helmet Detection Based On
Improved YOLO V3 Deep Model”, in IEEE 16th International
Conference on Networking, Sensing and Control (ICNSC), May
2019.
Fig.8. Output of method 2 after checking if the biker is wearing helmet or not [7] Felix Wilhelm Sieberta, Hanhe Linb "Deep Learning-Based
Safety Helmet Detection in Engineering Management Based on
After checking for the helmet-wearing bikers, we Convolutional Neural Networks", Department of Psychology
extracted the number plates of the bikers not wearing helmets and Ergonomics, Berlin, Germany, 2019.
using EasyOCR as shown in Fig. 9. [8] Yonten J., Panomkhawn R., Rattapoom W., “Real-time
number plate detection for non-helmeted motorcyclist using
YOLO”, Received 29 November 2019; received in revised form
3 June 2020; accepted 31 July 2020, Available online 22 August
2020.
[9] A. Adil, H. S. Umer, M. Z. Khan, “Automatic Helmet
Violation Detection of Motorcyclists from Surveillance Videos
using Deep Learning Approaches of Computer Vision” in
Fig. 9. Easy OCR output after number plate recognition International Conference on Artificial Intelligence (ICAI),
Pakistan, April 2021.
V. CONCLUSION [10] Tushar Goel, Dr. K.C. Tripathi, Dr. M.L. Sharma, “Single
Line License Plate Detection Using OpenCV And Tesseract”,
We use the YOLOv5 Algorithm which is considered to International Research Journal of Engineering and Technology
be the best in real-time object detection algorithm. We have used (IRJET), May 2020.
two methods for detecting whether the motorcyclist is wearing [11] Ritik Singh, Shubham Shetty, Gaurav Patil, Pramod J.
a helmet or not and proceeded with the extraction of the number Bide, “Helmet Detection Using Detectron2 and EfficientDet,
12th International Conference on Computing Communication
plate. This number plate character was displayed in text format.
and Networking Technologies (ICCCNT), July 2021.
This text format is stored in a sheet for violating the law of not [12] Abhinu C G, Aswin P, Kiran Krishnan, Bonymol Baby, Dr.
wearing a helmet. We achieved a mAP of 0.995 for detecting K S Angel Viji, “Multiple Object Tracking using Deep Learning
objects and overlapping conditions make our work different with YOLO V5”, in International Journal of Engineering
from any others. Our project makes this system autonomous and Research & Technology (IJERT), August 2021.
makes it easier for the authority to penalize people. [13] Open Images Dataset (OIDv6):
https://storage.googleapis.com/openimages/web/visualizer/inde
x.html?set=train&type=segmentation&r=false&c=%2Fm%2F0
REFERENCES 1d380
[14] Makesense (Image Annotation Tool):
[1] J. Chiverton, “Helmet presence classification with https://www.makesense.ai/
motorcycle detection and tracking,” Intelligent Transport [15] LabelImg (Image Annotation Tool):
Systems (IET), vol. 6, no. 3, September 2012. https://github.com/tzutalin/labelImg
[2] Z. Chen, T. Ellis, and S. Velastin, “Vehicle detection, [16] Roboflow (Data Augmentation Tool):
tracking and classification in urban traffic,” in Procs. of the https://roboflow.com/
IEEE Int. Conf. on Intelligent Transportation Systems (ITS), [17] Ultralytics YOLOv5: https://ultralytics.com/yolov5
Anchorage, AK, Sept 2012. [18] “Tesseract” vs “Keras-OCR” vs “EasyOCR”, Thanga
[3] C. Patel, D. Shah, A. Patel, “Automatic Number Plate Sami, 2021 URL: https://medium.com/mlearning-ai/tesseract-
Recognition System”, Article in International Journal of vs-keras-ocr-vs-easyocr-ec8500b9455b
Computer Applications, May 2013. [19] Weights and Biases (Wandb): https://wandb.ai/home
[6] Shaoqing Ren, Kaiming He, Ross Girshick, Jian Sun, “Faster
R-CNN” Submitted on 4 Jun 2015 (v1), last revised 6 Jan 2016.
Authorized licensed use limited to: Zhejiang University. Downloaded on March 03,2025 at 10:30:39 UTC from IEEE Xplore. Restrictions apply.
6