You are on page 1of 5

International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056

Volume: 06 Issue: 12 | Dec 2019 www.irjet.net p-ISSN: 2395-0072

Helmet Detection using Machine Learning and Automatic License


Plate Recognition
Lokesh Allamki1, Manjunath Panchakshari2, Ashish Sateesha3, K S Pratheek4
1,2,3,4BNMIT, BENGALURU
---------------------------------------------------------------------***---------------------------------------------------------------------
Abstract - Motorcycle accidents have been rapidly growing The objective of this paper is to develop a system to enforce
through the years in many countries. In India more than 37 helmet wearing with the help of CCTV cameras. The
million people use two wheelers. Therefore, it is necessary to developed system aims in changing unsafe behaviors and
develop a system for automatic detection of helmet wearing consequently reducing the number of accidents and its
for road safety. Therefore, a custom object detection model is severity.
created using a Machine learning based algorithm which can
detect Motorcycle riders. On the detection of a Helmetless 2. RELATED WORK
rider, the License Plate is extracted and the Licence Plate
number is recognized using an Optical Character Recognizer. Over the past years, multiple approaches have been
This Application can be implemented in real-time using a proposed to solve the problem of helmet detection. The
Webcam or a CCTV as input. authors in [7] use a background subtraction method to
detect and differentiate between moving vehicles. And they
Key Words: Automatic License Plate Recognition (ALPR), used Support Vector Machines (SVM) to classify helmets and
Deep Neural Network (DNN), Helmet Detection, Machine human heads without helmets. Silva et al. in [9] proposed a
Learning, Mean Average Precision (mAP), Optical hybrid descriptor model based on geometric shape and
Character Recognition (OCR), You Only Look Once texture features to detect motorcyclists without helmet
(YOLO). automatically. They used Hough transform with SVM to
detect the head of the motorcyclist. Additionally, they extend
1. INTRODUCTION their work in [10] by multi-layer perception model for
classification of various objects.
The main safety equipment of motorcyclist is the helmet. The
helmet protects the motorcyclist against accidents. Although Wen et al. [10b] uses a circle arc detection method based
the helmet use is mandatory in many countries, there are upon the Hough transform. They applied it to detect helmet
motorcyclists that do not use it or use it incorrectly. Over the on the surveillance system. The drawback of this work is that
past years many works have been carried out in traffic they only use geometric features to verify if any safety
analysis, including vehicle detection and classification, and helmet exists in the set. Geometric features are not enough
helmet detection. Intelligent traffic systems were to find helmets. In [11b] it proposes a computer vision
implemented using computer vision algorithms, such as: system aiming to detect and segment motorcycles partly. A
background and foreground image detection to segment the helmet detection system is used, and the helmet presence
moving objects in scene and image descriptors to extract verifies that there is a motorcycle. In order to detect the
features. Computational intelligence algorithms are used too, helmet presence, the edges are computed on the possible
like machine learning algorithms to classify the objects. helmet region. The Canny edge detector [12b] is used.

Machine learning (ML) is the field of Artificial Intelligence in Waranusat et al. [11] proposed a system to detect moving
which a trained model works on its own using the inputs objects using a k-NN classifier over the motorcyclist’s head
given during training period. Machine learning algorithms to classify helmet. These models were proposed based on
build a mathematical model of sample data, known as statistical information of images and had a limitation to the
"training data", in order to make predictions or decisions level of accuracy that could be achieved.
and are also used in the applications of object detection.
Therefore, by training with a specific dataset, a Helmet With the evolution of neural networks and deep learning
detection model can be implemented. Using this helmet models there was further improvement in the accuracy of
detection model helmet-less riders can be easily detected. classification. Alex et al. [13] introduced a convolutional
Based one the detected classes the license plate of the rider neural network (CNN) based method for object classification
is cropped out and saved as an image. This image is given to and detection. A. Hirota et al. [12] use a CNN for classification
an Optical Character Recognition (OCR) model which of helmeted and non-helmeted riders. Although they use
recognizes the text and gives the License Plate number as CNN, their helmet detection accuracy is poor with limitations
output in the form of Machine encoded text. And it can also to helmet color and multiple riders on a single motorcyclist.
be implemented in real time using a Webcam.

© 2019, IRJET | Impact Factor value: 7.34 | ISO 9001:2008 Certified Journal | Page 80
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 06 Issue: 12 | Dec 2019 www.irjet.net p-ISSN: 2395-0072

3. PROPOSED METHODOLOGY The training is done by feeding all the captured images with
their annotations. The model extracts the features of each

class from every image with the help of ground truth of the
required classes. For extracting the features and storing
For real-time helmet detection, there is a need for accuracy them to recognize those features from other images, we use
and speed. Hence a DNN based model You Only Look Once a deep learning, classifier based on the convolutional neural
(YOLO) was chosen. YOLO is a state-of-the-art, real-time networks. When an image is given to this trained model the
object detection system. detection of the pretrained class is necessary. A few images
are taken as an example to show the detection capability of
YOLOv3 is extremely fast and accurate and is a huge the custom trained model.
improvement over the previous YOLO versions. It also makes
predictions with a single network evaluation unlike systems 3.1 Helmet Detection
like R-CNN which require thousands for a single image. This
makes it extremely fast, more than 1000x faster than R-CNN The annotated images are given as input to YOLOv3 model to
and 100x faster than Fast R-CNN [4]. train for the custom classes. The weights generated after
training are used to load the model. Once this is done, an
Object detection is the craft of detecting instances of a image is given as input. The model detects all the five classes
certain class, like animals, humans and many more in an trained. From this we obtain the information regarding
image or video. The Pre-Existing Object Detection API makes person riding motorbike. If the person is not wearing a
it easy to detect objects by using pretrained object detection helmet, then we can easily extract the other class
models. But these models detect several Objects which are of information of the rider. This can be used to extract the
no use to us, therefore in order to detect the necessary license plate.
classes a custom object detector becomes necessary.
3.2 License Plate Extraction
In order to implement helmet detection and number plate
recognition and extraction, 5 objects need to be detected. Once the helmetless rider is detected, the associated person
The objects are – Helmet, No Helmet, Motorbike, Person class is detected. This is done by finding whether the co-
(sitting on the bike) and License Plate. ordinates of the no helmet class lie inside the person class or
not. Similarly, the same steps are followed to detect the
There is a need to create a custom object detection model associated motorbike and license plate. Once the coordinates
that is capable of detecting these objects. A collection of of the License plate are found, it is cropped and saved as a
images containing the objects of the classes to be detected new image.
are used as a Dataset. This dataset is then used to train the
custom model. Once the model has been trained, it can be
used to detect these custom objects.

© 2019, IRJET | Impact Factor value: 7.34 | ISO 9001:2008 Certified Journal | Page 81
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 06 Issue: 12 | Dec 2019 www.irjet.net p-ISSN: 2395-0072

accurately. Then, the license plate recognized with highest


confidence value is stored in a text file for further use.

4. REAL TIME IMPLEMENTATION

4.1 Using Webcam


The webcam can be used as the input device to receive the
image frames for object detection in real-time. Since we are
using YOLOv3-tiny model, it supports up to 220 fps
processing speed.

4.2 Using IP Webcam for Mobile


Mobile camera can be used as the input rather than using the
webcam. This can open up a lot of possibilities as mobile can
be carried and can cover different angles. Doing all this in
real-time is an added advantage. So, from this not only CCTV
footages but a handheld device can be used for obtaining the
footage. Also, the footage from mobile being up-close can
provide a clearer and more readable number plate for the
OCR to give out an accurate number.

5. RESULTS
3.3 License Plate Recognition The model was trained on tiny YOLOv3 for 11,000 images on
5 classes for 50,000 iterations. The detections of all the
objects classes was obtained with high precision value and
The extracted license plate is given to an Optical Character the mean average precision (mAP) reached a constant max
Recognition (OCR) model. The OCR recognizes text in the value of 75% hence the training was stopped at 50,000
given image and outputs the recognized strings in the iterations.
machine-encoded text. The OCR module within will output a
list of predicted license plate numbers along with a
confidence value. The confidence value indicates how
confident it is in recognizing the given license plate

© 2019, IRJET | Impact Factor value: 7.34 | ISO 9001:2008 Certified Journal | Page 82
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 06 Issue: 12 | Dec 2019 www.irjet.net p-ISSN: 2395-0072

A few examples of the input image and the output object


detector are shown in the figure below

6. CONCLUSION
From the results shown above it is evident that the YOLO
object detection is well suited for real-time processing and
was able to accurately classify and localize all the object
classes. The proposed end-to-end model was developed
successfully and has all the capabilities to be automated and
deployed for monitoring. For extracting the number plates
some techniques are employed by considering different
cases such as multiple riders without helmets and designed
to handle most of the cases. All the libraries and software
used in our project are open source and hence is very flexible
and cost efficient. The project was mainly built to solve the
problem of non-efficient traffic management. Hence at the
end of it we can say that if deployed by any traffic
management departments, it would make their job easier
The code extracts the License plate from the Object detector and more efficient.
output. The License plate extraction code extracts only from
the motor bikes which has a rider who is not wearing helmet REFERENCES
and discards the License plate of the motor bikes whose
rider has helmet. [1] Viola and Jones, “Robust Real-time Object Detection”,
IJCV 2001.
The OCR model is able to detect and recognize the License
plates present in an image with an accuracy up to 85 percent. [2] Navneet Dalal and Bill Triggs, “Histogram of oriented
An example of the recognized license plate are shown in the gradients for human detection”.
following figure.
[3] Ross, Jeff, Trevor and Jitendra “Rich feature Hierarchy for
Accurate object Detection”.

© 2019, IRJET | Impact Factor value: 7.34 | ISO 9001:2008 Certified Journal | Page 83
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 06 Issue: 12 | Dec 2019 www.irjet.net p-ISSN: 2395-0072

[4] Shaoqing Ren, Kaiming He, Ross Girshick, Jian Sun, “Fast
R-CNN” (Submitted on 4 Jun 2015 (v1), last revised 6 Jan
2016 (this version, v3)).

[5] Joseph Redmon, Ali Farhadi, “YOLO9000: Better, Faster,


Stronger”, University of Washington, Allen Institute Of AI.
[6] Joseph Redmon, Ali Farhadi, “YOLOv3: An Incremental
Improvement”, University of Washington, Allen Institute of
AI.

[6] Wei Liu, Dragomir Anguelov, Dumitru Erhan, Christian


Szegedy, Scott Reed, Cheng – Yang Fu, Alexander C. Berg,
“SSD: Single Shot MultiBox Detector”.

[7] A. Adam, E. Rivlin, I. Shimshoni, and D. Reinitz, “Robust


real-time unusual event detection using multiple fixed-
location monitors,” IEEE Transactions on Pattern Analysis
and Machine Intelligence, vol. 30, no. 3, pp. 555–560, March
2008.

[8] AlexeyAB,
https://github.com/AlexeyAB/darknet#requirements.

[9] C.-Y. Wen, S.-H. Chiu, J.-J. Liaw, and C.-P. Lu, “The safety
helmet detection for atm’s surveillance system via the
modified hough transform,” in IEEE 37th Annual
International Carnahan Conference on Security Technology.,
2003, pp. 364–369.

[10] C.-C. Chiu, M.-Y. Ku, and H.-T. Chen, “Motorcycle


detection and tracking system with occlusion segmentation,”
in WIAMIS ’07, USA, 2007

[11] A. Hirota, N. H. Tiep, L. Van Khanh, and N. Oka,


Classifying Helmeted and Non-helmeted Motorcyclists. Cham:
Springer International Publishing, 2017, pp. 81–86.

© 2019, IRJET | Impact Factor value: 7.34 | ISO 9001:2008 Certified Journal | Page 84

You might also like