Institute of Engineering: Tribhuvan University

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

TRIBHUVAN UNIVERSITY

INSTITUTE OF ENGINEERING
THAPATHALI CAMPUS

A seminar paper on

“Use of Machine Learning on Traffic Management System”

by

Anwesh Ghimire

27257

A REPORT

SUBMITTED TO THE DEPARTMENT OF INDUSTRIAL ENGINEERING

IN PARTIAL FULFILMENT OF THE REQUIREMENTS FOR THE

DEGREE OF

BACHELOR IN INDUSTRIAL ENGINEERING

DEPARTMENT OF INDUSTRIAL ENGINEERING

KATHMANDU, NEPAL

May, 2022
COPYRIGHT

The author has agreed that the library, Department of Industrial Engineering, Thapathali
Campus, Institute of Engineering may make this Report freely available for inspection.
Moreover, the author has agreed that permission for extensive copying of this Report for
scholarly purpose may be granted by the professor(s) who supervised the work recorded
herein or, in their absence, by the Head of the Department wherein the Report was done.
It is understood that the recognition will be given to the author of this Report and to the
Department of Industrial Engineering, Thapathali Campus, Institute of Engineering in
any use of the material of this Report. Copying or publication or the other use of this
Report for financial gain without approval of the Department of Industrial Engineering,
Thapathali Campus, Institute of Engineering and author’s written permission is
prohibited. Request for permission to copy or to make any other use of the material in
this Report in whole or in part should be addressed to:

Head

Department of Industrial Engineering

Thapathali Campus, Institute of Engineering

Kathmandu, Nepal

2
TRIBHUVAN UNIVERSITY

INSTITUTE OF ENGINEERING
THAPATHALI CAMPUS

DEPARTMENT OF INDUSTRIAL ENGINEERING

It is hereby certified that this report, entitled


“A seminar paper on use of machine learning for road traffic management”

prepared by Anwesh Ghimire (27257)


is an outcome of the research conducted under
“Department of Industrial Engineering”

The facts and ideas presented in this paper are an outcome of the student’s hard work
and dedication to the project, undertaken as a partial fulfillment for requirements for
degree of

Bachelor in Industrial Engineering.

The outcome of this project has been highly appriciated.

_____________________ _____________________

Supervisor External Examiner

Sushant Raj Giri Bikram Dahal

Deputy HOD, Industrial Chief Technical Officer

Engineering Docsumo Pte Ltd

_____________________
Head

Department of Industrial Engineering


Bishworam Parajuli

3
ABSTRACT

Managing road traffic management has always been a hassle in the context of Nepal.
Daily commuters face some sort of obstacles on the road almost every day. Even with the
prevalent problem, the traffic management has not achieved any impeccable outcomes
over the years. The rate of vehicle sales growth shows that the problem of traffic
management is not ending anytime soon with only the use of current technology and
system. Relating to the context this paper talks about how machine learning can be used
to help ease the traffic management system of Nepal.

Machine learning is a medium in which a large number of data is fed and the system
allows to learn patterns and similarities in those data or behavior in those data to proceed
with the required task. The road traffic management system that uses machine learning
can also be termed as intelligent traffic management system. Such technology is being
used worldwide to facilitate efficient traffic management.

Machine learning system for road traffic management uses technology such as object
detection and image segmentation to track the traffic on the road. Such technology can
then be used to predict and reduce traffic congestion and also track road law violations.
Since the process requires high power computers and cameras, the direct methodology
could not be used for this report. However, I was able to source my video of a traffic
junction as a data to an image tracking software which processed my data and gave me
the result as required.

The result was astonishing but as expected. It was able to track and predict the traffic
congestion and also find several road law violations that manual or human traffic officers
had a blind eye on. This report talks about the process of how machine learning can be
used to manage road traffic in detail.

Keywords/phrases : commuters, congestion, junction, road law violation

4
ACKNOWLWDGEMENT

I would like to thank Mr. Bishworam Parajuli, Head of Department, Industrial


Engineering Campus for providing me with this opportunity to perform the study. His
guidance during the pre-final presentation was crucial for carrying out the research.

I extend my thanks to Mr. Sushant, deputy head of department, Industrial Engineering


for supervising me during the course of study. The report would not have been
successfully concluded without his help.

Finally, I also extend my thanks to all the teachers, faculty members and classmates for
their time and support during the course of my study.

5
TABLE OF CONTENTS

COPYRIGHT ............................................................................................................. 2

ABSTRACT ................................................................................................................ 4

ACKNOWLWDGEMENT ........................................................................................ 5

TABLE OF CONTENTS ........................................................................................... 6

LIST OF FIGURES ................................................................................................... 8

LIST OF ACRONYMS AND ABBREVIATIONS ................................................... 9

CHAPTER ONE: INTRODUCTION...................................................................... 10

1.1 Background of the study........................................................................ 10

1.2 Adaptation of TMS with the help of machine learning........................... 10

1.3 Convolutional Neural Network.............................................................. 11

1.3.1 Convolutional Layer .............................................................................. 11

1.3.2 Pooling Layer ........................................................................................ 12

1.4 Problem Statement ................................................................................ 12

1.5 Objectives ............................................................................................. 13

1.5.1 General Objective ................................................................................. 13

1.5.2 Specific objective .................................................................................. 13

1.6 Significance of study ............................................................................. 13

1.7 Limitation ............................................................................................. 13

CHAPTER TWO: LITERATURE REVIEW ......................................................... 14

CHAPTER THREE: RESEARCH METHODOLOGY ......................................... 15

3.1 Sources of data ...................................................................................... 15

3.1.1 Primary source ...................................................................................... 15

3.1.2 Secondary source of data ....................................................................... 15

3.2 Study Design......................................................................................... 16

CHAPTER FOUR: RESULT AND CONCLUSION .............................................. 17

6
4.1 Case Study ............................................................................................ 17

4.1.1 Study 1:................................................................................................. 17

4.1.2 Study 2:................................................................................................. 17

4.1.3 Study 3:................................................................................................. 17

4.2 Results/ Expected results ....................................................................... 18

4.2.1 Study 1:................................................................................................. 18

4.2.2 Study 2:................................................................................................. 18

4.2.3 Study 3:................................................................................................. 19

4.3 Conclusion and recommendation ........................................................... 21

REFERENCES ......................................................................................................... 23

ANNEX A ................................................................................................................. 24

ANNEX B ................................................................................................................. 26

ANNEX C ................................................................................................................. 27

7
LIST OF FIGURES

Figure 3. 1: Study Design ........................................................................................... 16


Figure 4. 1: Traffic Congestion Detection ................................................................... 18
Figure 4. 2: Before lane violation occurs .................................................................... 19
Figure 4. 3: After lane violation occurs ....................................................................... 20
Figure 4. 4: Chart showing accuracy for study 1 for lane violation .............................. 20
Figure 4. 5: Chart showing accuracy for study 3 for signal jump ................................. 21
Figure A. 1: Convolutional Layer Code ...................................................................... 24
Figure A. 2: Output parameters................................................................................... 25
Figure A. 3: Output parameters................................................................................... 25
Figure B. 1: YOLOv3 algorithm ................................................................................. 26
Figure B. 2: Convolutional Neural Network Overview ............................................... 26
Figure C. 1: lane violation dataset image .................................................................... 27
Figure C. 2: Traffic congestion dataset image ............................................................. 27

8
LIST OF ACRONYMS AND ABBREVIATIONS

CNN Convolutional Neural Network

YOLO You Only Look Once

TMS Traffic Management System

ITMS Intelligent Traffic Management System

ITS Intelligent Traffic System

CCTV Closed-circuit Television

ROI Region Of Interest

API Application Programming Interface

RFID Radio-frequency Identification

IOT Internet Of Things

9
CHAPTER ONE
INTRODUCTION

1.1 Background of the study


Road traffic condition is one of major problems in big cities especially in the developing
countries, like in Nepal. There are so many bad effects caused by this traffic problem,
like massive delays and the increased fuel wastage and monetary losses. The road traffic
can happen because of limited number of facilities and infrastructures, huge number of
people, and inappropriate policy from the government. Kathmandu traffic junctions has
one of the worst traffic management systems among the capitals around the world. The
traffic congestion along with numerous road law violations lead to inefficient means of
transport and various accidents. Evidently the current system of Traffic Management
seems inefficient, ineffective and inadequate to tackle this difficult scenario. Machine
learning technologies can be used to tackle this problem and help ease the TMS.

Intelligent Traffic System (ITS) has been developed to solve the road traffic condition
globally. It uses supported data, such as airborne optical remote sensing sensor, wireless
signal communication (i.e. probe vehicle-to-vehicle). Nevertheless, in the developing
countries, the first problem is that the data is not available because of the expensive
infrastructure and maintenance cost. Another alternative is utilizing data from traffic
video and captured image with manually processing by human. Manually processing
requires handcrafted features and manual calculation like calculating the distance and the
level of the traffic congestion between vehicle. Manually processing depends on the
human ability and requires time which is not short.

Through machine learning. a method to detect the road traffic congestion automatically
by utilizing the data from CCTV camera image feeds can be used. Convolutional Neural
Networking and processing of the data can be implemented to overcome the limitations
and even increase the efficiency of TMS.

1.2 Adaptation of TMS with the help of machine learning


Congestion has become a difficult problem as network traffic grows faster than the
available traffic infrastructure. Machine learning adapted to manage traffic monitors the
vehicle and reduce the time spent on the traffic light as well as suggesting an alternative
route with the to the vehicle. Avoided traffic jams with the help of TMS, which works

10
based on the input of the video sequence extracted from the convolutional neural network.
The training process was implemented using the convolutional neural network topology
built using the YOLO algorithm. This technique works with spatial recognition of objects
in video frames. This was considered an input to most tracking algorithms. TMS using
machine learning also uses a rectangular region of interest (ROI), where segments
objects. Features of the Intelligent Traffic Signal Management System takes the picture
of the Transportation Hub and update it to the cloud using the CloudVision API Density
Help. The type of vehicle in the traffic that needs to be detected is taken as input and
updated using the Cloud Vision API density in the cloud. The vehicle type is detected
and then the status is sent to the previous signal. The previous signal, which is the current
signal, checks for the status of the next signal and continues operation. This process helps
the trigger an RFID placed next to the signal and detect vehicles passing through the
platform. As a result, the IoT and machine learning cameras use the sensor with two
controller boards. The camera sensor captures details from the trace and transfers the data
to the first controller board. The control panel uses this to adjust the traffic light and the
traffic light as appropriate. The MinMax fairness algorithm is used after estimating the
difference of between the counts of the two lanes. Lane, which has the lowest average
wait time, has priority.

1.3 Convolutional Neural Network


Convolutional Neural Network (CNN) is a variant of standard neural network which is
specifically designed to process sequence data such as image. It requires minimal data
preprocessing and it can automatically detect the invariant and extract important features.
There are two main components of CNN: convolutional layer and pooling layer. The
components are mainly inspired by mammalian visual cortex that have two basic cell
types: complex cells (convolution layer) which have receptive fields and are locally
invariant to exact position of the pattern, and simple cells (pooling layer) that respond
maximally to specific edge-like patterns within their receptive field. A basic CNN usually
consists of one or more convolution-pooling layers and fully-connected layer(s). CNN
uses three main ideas: local receptive fields, shared weights, and pooling.

1.3.1 Convolutional Layer


Convolution layer is the layer that performs the main operation of CNN. This layer is
used to generating feature maps of a spatial input through convolution operations. In the
convolution operation, a filter/kernel with certain spatial size along the input features.

11
Suppose we have input feature that represented as a two-dimensional feature map 𝑥𝑥with
size P1*X1, convolutional kernel 𝑊 with size of 𝑚*𝑛, and shift 𝑠. The convolutive
operation can be denoted as 𝐶 =𝑋*W, where output C is called as feature map. Output C
has size of 𝑝2 × 𝑞2, where 𝑝2 = 1 + (𝑝1 – 𝑚2)/𝑠 and 𝑞2 =1+(𝑞1 − 𝑚)/𝑠. Each neuron
unit in the convolution layer is connected to the receptive field units in the corresponding
local area of size 𝑚×𝑛.

Suppose 𝑊(I,j) is the weight parameter that represented as convolutive kernel that
connects i-th feature map from previous layer 𝐶i to j-th feature map 𝐶i and 𝑏j is the
corresponding bias. One feature map in the convolutional layer can be computed as: 𝐶j=
𝜎( ∑I *𝑊ij ∗ 𝐶i + 𝑏j) where 𝑆 is the set of the selected feature maps from the previous
layer and 𝜎𝜎 denotes the activation function, which can be a sigmoid 𝜎(𝑥) = 1/(1 + 𝑒^(-
x)), hyperbolic tangent 𝜎(𝑥) = (1 − 𝑒^(−2𝑥))/(1 + 𝑒^(−2𝑥) ) or rectified linear units
(ReLU) 𝜎(𝑥) = max (0, 𝑥).

1.3.2 Pooling Layer


Pooling layer is another main component of CNN, which perform a non-linear down-
sampling. Max pooling is the most commonly non-linear functions used on the pooling
operation. This layer is composed a down-sampled feature maps generated by applying
pooling operation on the local area of the corresponding feature maps in the convolution
layer. Hence, the number of feature maps is the same but in smaller size. The purpose of
this layer is to reduce the resolution of feature maps, so then the number of parameters
and amount of computation can be reduced. The size of the local area is determined by a
parameter called pooling size. A local area may have overlapped area with the adjacent
area according to the area shift parameter called pooling stride.

1.4 Problem Statement


Current traffic management system which is mostly manual by a human resource is
inefficient in handling the traffic congestion and preventing road law violations in
heavy traffic junctions in Kathmandu or Nepal in general. The human resource
allocated just don’t seem enough in handling the pressure of busy traffic in
Kathmandu. Hence this paper discusses how the solution of the problem can be the
use of Machine learning technology to manage traffic.

12
1.5 Objectives
1.5.1 General Objective
To study about the use of Machine Learning in road traffic management

1.5.2 Specific objective


 To understand about convolutional neural network
 To use CNN to predict and manage traffic congestion
 To use CNN to detect road law violation

1.6 Significance of study


With increasing traffic across the nation as a result of the rising population and number
of vehicles, traffic management has increasingly become complex and requires additional
accuracy and efficiency apart from human intervention. Machine learning and its related
algorithms can fulfill these criteria as researched and provided.

1.7 Limitation
The study faced many limitations during the process. The lack of data relating to machine
learning and ITMS was one of the major obstacles. Nepal is yet to implement any form
of ITMS in real life which is why any form of research about the real-life implementation
in the topic, in the context of Nepal, was next to impossible. Another limitation of the
study was that the technology the paper talks about has high economic cost as it uses high
power computers and cameras hence it was not possible to do the study real time.

Major Limitation for the study was the lack of finance to outsource the dataset for
processing

13
CHAPTER TWO
LITERATURE REVIEW

Shwetha, R.J., et al. 2018, described an Intelligent traffic signal management system
using cloud vision API and Machine learning. The images of the next traffic junction are
taken and updated to cloud and by the help of cloud vision API density and type of
vehicles are detected which in turn returns status to the previous signal. The previous
signal which is now the present signal will check for the status of the next signal based
on the status it does further operation. This trigger the RFID place next to signal to be
enabled and detects the vehicles crossing it resulting which a penalty to be paid to traffic
control.

Aditi, Y., 2019, proposed an Adaptive traffic management system using IOT and
Machine learning. Camera sensors and two controller boards will play major roles. The
camera sensor will capture the details from the lane with live streaming and pass it on to
first controller board. This board will differentiate all the vehicles from obtained data by
using Tensor Flow and maintain the count of vehicles in a particular lane. This count will
be passed on to another controller board. This board will use this count to adjust the traffic
signals and congestion lights accordingly. If there is a great difference between the counts
of two lanes, then using the Min-Max Fairness algorithm, the priority will be given to
low average waiting time. If the difference is not much, then using the Round Robin
algorithm, the priority will be given to low traffic congestion.

Venkata, D., ,2019, proposed a smart traffic management system for smart cities using
Reinforcement learning algorithm. Compound optimization error can be successfully
handled by using reinforcement learning technique and thus Deep learning technique has
drawn enormous fascination. Seeing the various merits in combining reinforcement with
deep learning method we have decided to work on setting proper and effective traffic
controlling system using these effective techniques.

14
CHAPTER THREE
RESEARCH METHODOLOGY

Research methodology is a systematic way to solve the research problem. In alternative


words, research methodology describes the ways and method applied within the entire
side of the study. Research methodology refers to the various sequential steps to be
adopted by a researcher in studying a problem with certain objectives in view.

In this research I needed to deal with various parameters and data available through
various sources. It was imperative to understand the application of the data processing
in the practical scenario along with the technological and economic feasibility of the
proposed system. I tried to research the application of the proposed system in a global
scale as much as possible. The research talks about more general concept of machine
learning hence it was necessary to find out what topic within this concept would be
more suitable in the Nepalese context.

This research talks about the use of YOLO algorithm and CNN for TMS as a part of
machine learning. Most of the parameters were found from secondary data.

3.1 Sources of data


3.1.1 Primary source
As a primary source of data, I visited traffic control division of Kathmandu
metropolitan and talked with various personnel. I also interacted with personalities from
around the globe who are currently working on the field of ITMS.

3.1.2 Secondary source of data


As for the secondary data various internet articles, journals and research papers relating
to machine learning. road traffic management system, ITMS, CNN etc. were thoroughly
studied.

15
3.2 Study Design
Initially for the seminar topic, the ever-present problem of road traffic management was
selected. Then I researched about the best practices for road traffic management system
around the world and found out about how machine learning can be used to manage road
traffic. Further, I researched about the use of machine learning to manage road traffic in
the context of Nepal. Then, I thoroughly studied about the best component of machine
learning that can be used in terms of economic, technological feasibility. Also, the
practicality aspect of the system was studied.

After all the theoretical research, collection of data was started. I visited the junction at
Baneswor and captured various video files which was then forwarded to a video
processing website which used the proposed algorithm to find the results as required.
Then found out result was then analyzed and discussed to reach to a conclusion.

Figure 3. 1: Study Design

16
CHAPTER FOUR
RESULT AND CONCLUSION

4.1 Case Study


For the purpose of the study, traffic junction of New Baneswor was selected. The traffic
junction is an intersection with 4 roadways going out towards some of the busiest places
of the capital. The main problem as seen in this junction is that during peak hour a lot of
vehicles standby on at least two parts of the side of the intersection for 180seconds. The
peak hour being 9-11 and 4-6 pm. The prevalent traffic management system only works
in directing the traffic as they come but there is no system to redirect or reroute the
incoming traffic by predicting traffic congestion.

4.1.1 Study 1:
In a scenario of uneven traffic management system in Baneswor we see every day, all
the sides of the intersection have to wait for preset timer of 180 seconds regardless of the
traffic density. Meaning that, even if there is low traffic density on one side and high
traffic density on the other side of the intersection, the lane having high density of traffic
will still have to wait the same amount of time as the side having low traffic density which
only adds to the problem of traffic congestion.

4.1.2 Study 2:
Similar to the first study, in this scenario, having no means of predicting traffic congestion
the east side of Baneswor will still wait for whole preset timer as the other side of the
intersection even if very high number of vehicles are incoming towards the side from the
previous junction. This will add to the problem of traffic congestion.

4.1.3 Study 3:
Not only the traffic congestion system, we can see very frequently that people overlook
the traffic rules about traffic light regulation, lane violation, speed violation in the
junction which cannot be easily noticed by human traffic officers. This facilitates
unmanaged traffic and increases the chance of road accidents.

17
4.2 Results/ Probable results
4.2.1 Study 1:
For the first scenario, the video file data fed to the processing computer after being
captured by the placed high range and high-power cameras will detect each and every
vehicle in all the sides of the intersection through the use of CNN. Then the detected
objects are placed in the rectangular region of interest. The traffic density is calculated
by the no of vehicles in each side of the intersection.

Figure 4. 1: Traffic Congestion Detection

The data is then self-analyzed and the traffic light timer is self-adjusted by the system
without having to manually intervene. This will help manage traffic congestion that
comes forth due to scenario 1. The proposed algorithm is YOLOv3 algorithm.

Refer to ANNEX A for yolo algorithm overview

4.2.2 Study 2:
For the second scenario object detection and image segmentation techniques used will be
the same. The way by which the proposed system will be able to predict traffic congestion
is that, the data from previous junction will be fed to the cloud vision API along with
their RFID tags. The incoming traffic to the selected junction can be judged form the
number of vehicles leaving the previous junction towards the selected junction along with
the number of vehicles in the lane.

18
After predicting the traffic congestion, it can be linked with the new junction and timer
automation whether to reduce the timer of lane with high traffic congestion possibility.
Another measure that can be implemented is that the newer traffic that are incoming from
the newer junction can be given message on vehicle dashboard to reroute if possible, so
as to reduce the number of vehicle and time spent by the user on the junction.

4.2.3 Study 3:
For traffic law violation

All the images in a junction are detected and recorded along with the RFID tag associated
with the number plate. The violation parameters are input in the system. The lawful
vehicles are bounded by blue and unlawful actions by any vehicles turns the bounding
box overlapping into red.

Figure 4. 2: Before lane violation occurs

19
Figure 4. 3: After lane violation occurs

The result shows violation of the vehicle bounded in red ROI.

Chart Title
100%

95%

90%

85%

80%

75%

70%
1 2 3 4
Dataset

Figure 4. 4: Chart showing accuracy for study 1 for lane violation

20
Chart Title
84
82
80
78
76
74
72
70
68
dataset 5 dataset 6 dataset 7 dataset 8

Figure 4. 5: Chart showing accuracy for study 3 for signal jump

4.3 Conclusion and recommendation


From the above study and their result, we can conclude that Machine learning can be used
to effectively manage traffic congestion problems in Nepal. Machine learning makes it
very easy to predict traffic congestion and manage them resulting in reduced time any
vehicle has to stay in traffic. Implementation of Machine learning to detect road law
violations will help reduce these violations and keep traffic control in check.

For any authorities wishing to make further investigation on the topic, I’d recommend to
collect as much data as possible and also look to implement real time data processing
which was not done in this study. Further, the economic feasibility and technological
feasibility side of the study should also not be overlooked.

I’d recommend the traffic control division of Kathmandu valley to look into the
possibilities of adding the Machine learning system into the traffic control policy and also
start experimenting on certain junctions as intelligent traffic management system seems
to be the future of traffic management system,

21
22
REFERENCES

Sah, AK., “Machine Learning”, 2019. https://www.academia.edu

Rangwal, A., et al, 2020,” Traffic Rule Violation Detection System using ML”,

Nandhini, R, et al., 2021, “Traffic Management System using Machine Learning


Algorithm”.

Bae, SH., “A HYBRID DEEP CONVOLUTIONAL NEURAL NETWORK


APPROACH FOR PREDICTING THE TRAFFIC CONGESTION INDEX”, 2020.
https://traffic.fpz.hr/index.php/PROMTT/article/view/3657

Roopa, R., “Intelligent Traffic Violation Detection”, 2020.


https://www.researchgate.net/publication/355109949_Intelligent_Traffic_Violation_Det
ection

Kurniawan, J., “Traffic Congestion Detection: Learning from CCTV Monitoring Images
using Convolutional Neural Network”, 2018. https://www.sciencedirect.com

Ritu, R., “Traffic Management using Machine Learning”, 2022.


https://www.researchgate.net/publication/357717170_Traffic_Management_using_Mac
hine_Learning

23
ANNEX A

Figure A. 1: Convolutional Layer Code

24
Figure A. 2: Output parameters

Figure A. 3: Output parameters

25
ANNEX B

Figure B. 1: YOLOv3 algorithm

Figure B. 2: Convolutional Neural Network Overview

26
ANNEX C

Figure C. 1: lane violation dataset image

Figure C. 2: Traffic congestion dataset image

27

You might also like