Astm: Autonomous Smart Traffic Management System Using Artificial Intelligence CNN and LSTM
Astm: Autonomous Smart Traffic Management System Using Artificial Intelligence CNN and LSTM
Email: [email protected]
Abstract—In the modern world, the development of Artificial After that, until 1974, AI grew rapidly because a lot
Intelligence (AI) has contributed to improvements in various of investment was put into the field, and computers could
areas, including automation, computer vision, fraud detection, store more information and became faster, cheaper, and more
and more. AI can be leveraged to enhance the efficiency of
Autonomous Smart Traffic Management (ASTM) systems and accessible. However, at the start of 1980, AI entered the ”dark
reduce traffic congestion rates. This paper presents an Au- era” due to many obstacles, such as a lack of computational
tonomous Smart Traffic Management (STM) system that uses power to do anything substantial; computers simply couldn’t
AI to improve traffic flow rates. The system employs the YOLO store enough information or process it fast enough, which
V5 Convolutional Neural Network to detect vehicles in traffic discouraged many investors and researchers from delving
management images. Additionally, it predicts the number of
vehicles for the next 12 hours using a Recurrent Neural Network deeper into this field. Until the end of the 20th century, AI
with Long Short-Term Memory (RNN-LSTM). The Smart Traffic development went through a roller coaster of success and
Management Cycle Length Analysis manages the traffic cycle setbacks, including famous “deep learning” techniques that
length based on these vehicle predictions, aided by AI. From the allowed computers to learn using experience, popularized by
results of the RNN-LSTM model for predicting vehicle numbers John Hopfield and David Rumelhart in the 1980s [8].
over the next 12 hours, we observe that the model predicts traffic
with a Mean Squared Error (MSE) of 4.521 vehicles and a Root In 1997, AI regained hype after IBM’s Deep Blue, a chess-
Mean Squared Error (RMSE) of 2.232 vehicles. After simulating playing computer program, defeated reigning world chess
the STM system in the CARLA simulation environment, we found champion and grandmaster Garry Kasparov [5]. However, it
that the Traffic Management Congestion Flow Rate with ASTM was not until 2012 that AlexNet, a CNN architecture by Alex
(21 vehicles per minute) is 50% higher than the rate without Krizhevsky and his team, won the 2012 ImageNet annual
STM (around 15 vehicles per minute). Additionally, the Traffic
Management Vehicle Pass Delay with STM (5 seconds per vehicle) image recognition challenge by a huge margin, reigniting
is 70% lower than without STM (around 12 seconds per vehicle). development in the AI field [4]. To this day, numerous develop-
These results demonstrate that the STM system using AI can ments have emerged in AI, attributed to the vast amount of data
increase traffic flow by 50% and reduce vehicle pass delays by available to train models, tremendous increases in computing
70%. power since the 1990s, and the introduction of revolutionary
AI architectures with significantly higher performance and
I. I NTRODUCTION usability.
Nowadays, Artificial Intelligence (AI) development has con-
A. Artificial Intelligence
tributed to improvements in various areas, including scientific
The development of Artificial Intelligence (AI) began in research, industry, environmental sectors, and governmental
1943 when neurophysiologist Warren McCulloch and mathe- and social issues. For example, AI has proven effective in
matician Walter Pitts published a paper introducing Artificial solving a variety of practical problems such as disease detec-
Neural Networks (ANN) to the world [5]. The development tion [6], language translation [7], autonomous self-driving cars
of AI started to gain attention when British polymath Alan [2], and customer behavior prediction [9].
Turing published his paper ”Can Machines Think?” in 1950, However, AI development has been hampered by difficulties
where Turing suggested that machines can do the same things in sharing ML models and differences in dependencies and
as humans, using available information and reasoning to solve machine environments, making it challenging to deploy a
problems and make decisions [5]. The development of AI model across different machines [1]. Usually, ML models
officially started after Allen Newell, Cliff Shaw, and Herbert contain multi-stage, complex pipelines with procedures that
Simon published the proof of concept in the first AI program are sequentially entangled and mixed together, such as pre-
named Logic Theorist in 1955 [5]. processing, feature extraction, data transformation, training,
and validation [4]. Hence, improving an individual component C. Traffic Congestion Prediction using Artificial Intelligence
may, in fact, worsen overall performance due to the strong One application of Artificial Intelligence is predicting traffic
correlations between components. Therefore, building models congestion. By analyzing traffic time, traffic jam conditions,
becomes a trial-and-error-based iterative process that demands and weather conditions, AI can predict traffic congestion ef-
expert-level knowledge in ML concepts to create and tune ML fectively. Recurrent neural networks (RNNs) are deep learning
models manually [10]. Moreover, because of the dependencies models typically used to solve problems with sequential input
for different AI tools like TensorFlow, Keras, and PyTorch, data, such as time series. RNNs retain a memory of previously
machine dependencies must be installed manually, which is processed inputs and learn from these iterations during training
often a time-wasting process and not always straightforward [1].
[23]. To understand RNNs, consider that they are a class of
artificial neural networks where connections between nodes
form a directed graph along a temporal sequence. This allows
B. Object Detection using Computer Vision them to exhibit temporal dynamic behavior. Unlike feedfor-
ward neural networks, which do not retain memory, RNNs can
Object Detection using Computer Vision involves detecting
process variable-length sequences of inputs [9]. RNNs share
objects around Artificial Intelligence Sensor Image Cameras.
parameters across each layer of the network, and while they
In computer vision, convolutional neural networks (CNNs)
adjust weights during training, they often face challenges such
are very popular for tasks like image classification, object
as exploding and vanishing gradients [22]. The architecture of
detection, image segmentation, drivable area detection [2],
the Recurrent Neural Network for predicting traffic congestion
3D point cloud object completion [3] and more. Image clas-
can be seen below.
sification is one of the most needed techniques in today’s
era; it is used across various domains like healthcare and
business. Thus, knowing and creating your own state-of-the-
art computer vision model is a must if you’re in the AI
domain. Most computer vision algorithms utilize something
called a convolutional neural network (CNN). A CNN is a
model used in machine learning to extract features, like texture
and edges, from spatial data. Like basic feedforward neural
networks, CNNs learn from inputs, adjusting their parameters
(weights and biases) to make accurate predictions. However,
what makes CNNs special is their ability to extract features
from images. Take an image of a car, for example. In a normal
feedforward neural network, the image would be flattened
into a feature vector. However, CNNs can treat images like Fig. 2. Recurrent Neural Network Architecture for Traffic Congestion System
Prediction using Artificial Intelligence
matrices and extract spatial features, such as texture, edges,
and depth. They accomplish this through convolutional layers
and pooling. The architecture of the Artificial Intelligence D. Smart Traffic Management Systems
Convolutional Neural Network can be seen below. One cornerstone of smart city design is having an inte-
grated smart transportation solution. It can be argued that
a city is not completely intelligent without a smart traffic
management system. Intelligent transportation systems (ITS)
or smart traffic management systems (Figure 1) provide an
organized, integrated approach to minimizing congestion and
improving safety on city streets through connected technology.
The intelligent traffic management system market is expected
to grow to $19.91 billion by 2028 at a 10.1% CAGR, according
Fig. 1. Convolutional Neural Network for Image Detection in Artificial to PR Newswire. The demand and increased adoption rate of
Intelligence
smart traffic management solutions can be attributed to the
rise of smart city technology. Guidehouse Insights reports that
The CNN processes an image by applying a series of filters, there are more than 250 smart city projects globally.
resulting in feature maps that highlight different aspects of Symmetry Electronics supplier, Digi International, defines
the input image. The convolution kernel, which is a matrix smart traffic management systems as technology solutions that
of weights, slides over the input image matrix, performing municipalities can integrate into their traffic cabinets and inter-
element-wise multiplications and summing the results to pro- sections today for fast, cost-effective improvements in safety
duce a feature map. These feature maps allow CNNs to and traffic flow on their city streets. Efficient and success-
understand and categorize images based on spatial features. ful smart traffic management systems utilize next-generation
hardware and software to optimize traffic infrastructure (Figure helps identify congestion levels and improve roadway
2). The architecture of the Smart Traffic Management System operations.
using Artificial Intelligence can be seen below. 6) Level of Service (LOS): LOS is a grading system from
A to F used to evaluate traffic flow, where A indicates
free-flow conditions and F indicates heavy congestion.
7) Peak Period: The peak period is the time when con-
gestion is at its highest level, usually occurring dur-
ing morning and evening rush hours. Identifying peak
periods can help agencies optimize traffic management
strategies.
It is essential to analyze metrics to identify existing issues
and prioritize solutions. Advanced traffic management systems
can continuously collect data from the street network and
dynamically respond to changing traffic conditions. Traffic
signal timing can be adapted based on current congestion
levels, and information can be provided to drivers in real time
through digital signs or mobile applications. As technology
Fig. 3. Architecture of Smart Traffic Management using Artificial Intelligence continues to advance, the capabilities of smart traffic manage-
ment systems will continue to expand, ultimately leading to
Transportation plays a crucial role in any community, safer, more efficient roadways.
connecting people to jobs, services, and opportunities. Mon-
II. M ETHODOLOGY
itoring key metrics can provide valuable insight into how
a transportation system is performing and whether it meets In this project, the author proposes a novel architecture for
the needs of those who rely on it. This section explores a Smart Traffic Management System by using Artificial Intel-
some key transportation metrics to analyze in any community, ligence to intelligently manage traffic. First, we use Artificial
including measures of mobility, road safety, and accessibil- Intelligence to detect vehicles in traffic management system
ity. By understanding these metrics, community leaders and images. After detecting vehicles, we predict the number of
transportation professionals can make informed decisions to vehicles using Artificial Intelligence to estimate the traffic den-
improve transportation systems and enhance the overall quality sity. Then, the system manages the traffic cycle length based
of life for residents. Metrics to Measure Traffic Congestion in on fuzzy decision-making for traffic flow. The architecture
Smart Traffic Management can be seen below. of the autonomous Smart Traffic Management System using
Artificial Intelligence is illustrated in Figure 4.
1) Average Daily Traffic (ADT) and Annual Average Daily
Traffic (AADT): ADT and AADT quantify how busy a A. Smart Traffic Management System Vehicle Detection using
stretch of road or highway is, reporting the number of Convolutional Neural Network
vehicles passing through over a day or year, respectively.
They have many applications within traffic engineering, First, we detect vehicles in traffic management system
such as signal timing and determining where infrastruc- images using a Convolutional Neural Network (CNN). The
ture investments should go. CNN detects vehicles by analyzing the pixels and colors in the
2) Corridor Travel Times: Corridor Travel Times help images. For vehicle detection, the author uses the Road Vehicle
transportation agencies understand how long it takes to Image Dataset of Bangladesh Traffic, created by Ashfak Yeafi
travel between two points and allow them to identify in 2017. This dataset contains annotated images of Bangladesh
bottlenecks and improve planning and programming. road vehicles, with separate folders for training and validation
3) Speed: A common measure of traffic congestion is the images. The dataset includes over a million images, captured
speed at which vehicles travel on a roadway. It can be from January to December 2017.
averaged over specific time intervals or collected for an For the vehicle detection task, the author uses the YOLOv5
entire day, providing insight into how traffic conditions CNN model. YOLOv5 is widely used for object detection
change throughout the day. tasks and comes in four versions: small (s), medium (m),
4) Travel Time Index (TTI): TTI is a ratio of the travel large (l), and extra-large (x), each offering progressively higher
time during peak hours to the travel time during free- accuracy. YOLOv5 works by extracting features from images
flow conditions. TTI identifies congestion and can help and predicting bounding boxes and class labels for detected
agencies determine the effectiveness of congestion man- objects. It connects the process of predicting bounding boxes
agement strategies. and class labels in an end-to-end differentiable network.
5) Delay: Delay is the difference between the time a The YOLO network consists of three main components:
vehicle would take to travel in free-flow conditions and 1) Backbone: A convolutional neural network that aggre-
the time taken to travel under congested conditions. It gates and forms image features at different granularities.
Fig. 4. Architecture of Autonomous Smart Traffic Management System using Artificial Intelligence
2) Neck: A series of layers to mix and combine image 6) Weight Decay: A regularization technique that penalizes
features before passing them forward to prediction. large weights to prevent overfitting.
3) Head: Consumes features from the neck and performs The six most important hyperparameters for YOLOv5 tun-
the final box and class prediction. ing in vehicle detection can be seen in the following figure.
The architecture of YOLOv5 for Smart Traffic Management
System vehicle detection using CNN is shown below.
(1.5 × L + 5)
C=
(1.0 − SYi ) Fig. 7. Result Table of Tuning Hyperparameter YOLO V5 to Predict Smart
Traffic Management System Vehicles in Smart Traffic Management Images
Where: C = optimal cycle length in seconds (rounded to
the nearest 5 seconds), L = unusable time per cycle (e.g., From the results of tuning the hyperparameters of the YOLO
signal change intervals), SYi = critical lane volume for each V5 Convolutional Neural Network to detect vehicles in the
phase/saturation flow. Smart Traffic Management System, we can see that the best
The saturation flow is typically between 1500 and 1800 hyperparameter settings are from Search 1 with a learning rate
vehicles per hour. This formula can be used to calculate the of 0.0052, momentum of 0.595, mosaic parameter of 0.36,
signal timing for planning purposes. After determining the rotation degree of 72, scale of 1.32, and weight decay of
cycle length, the green time can be proportioned for each phase 0.0005, achieving a mean average precision (MAP) of 0.4034,
based on critical lane volumes. which is almost 50
Management System. The evaluation results are shown below.
After simulating the Smart Traffic Management System in
CARLA, we observe that the Traffic Management Congestion
Flow Rate with the Smart Traffic Management System (21
vehicles per minute) is 50
III. C ONCLUSION
Fig. 10. YOLO V5 Convolutional Neural Network Predicts Smart Traffic Fig. 12. Evaluation Results of the Smart Traffic Management System using
Management Vehicles in Smart Traffic Management Images Artificial Intelligence in the CARLA Traffic Management Simulator