MLP Bearing and Speed
MLP Bearing and Speed
Abstract— The popularity of autonomous vehicles has been development of the EUREKA Prometheus project. This project
on the rise, driven by technological advances, changes in public sought to develop technologies for autonomous vehicles,
perception, and market growth in recent years. Autonomous including a Mercedes 500 SEL that drove more than 1,000
vehicles use sensors, cameras, and equipment to understand
their environment and make appropriate driving decisions. In kilometers on the highway and could perform maneuvers
the development of autonomous cars, accurate prediction of such as overtaking other vehicles [Díez Ramírez, 2018].
speed and bearing is essential to ensure safe and efficient In 1997, in the United States, a demonstration of 20
performance. Although various deep learning methods, such as autonomous cars driving on a highway in San Diego
convolutional and recurrent networks, have been implemented, showed significant progress in the development of these
multilayer perceptron (MLP) networks for this task are still
poorly documented. This study explores the applicability of MLP vehicles [Rodríguez Hernández de Santamaría, 2020]. Today,
networks in simultaneous velocity and bearing prediction using a autonomous vehicles are experiencing a significant increase in
limited set of features extracted from sensors. Although the scope production and applications, with advances in the integration
of this work is exploratory and not intended to compete with of autonomous driving systems in commercial and private
more advanced models, the results offer an initial validation of vehicles. Major manufacturers such as Waymo, Tesla, Cruise,
the approach in a controlled context, providing a basis for future
research to optimize its performance. In conclusion, the use of and Aurora are leading the development of these technologies,
MLP networks proved to be an effective alternative for speed implementing tests and deployments in various cities and
and bearing prediction in autonomous vehicles, outperforming continuously improving their autonomous driving capabilities
reference sensors in terms of accuracy (MAE) and achieving R2 [KPMG, 2024].
coefficients of 0.96 and 0.94, respectively, which validates their
potential for applications in controlled environments.
Autonomous vehicles use various embedded systems to
Keywords— MLP, autonomous, vehicles, speed, bearing, pre-
diction
process the information coming from their sensors and make
decisions in real-time. The most common systems and what
they are based on are described below:
I. I NTRODUCTION
1) Perception Systems: These systems integrate data from
Autonomous vehicles have the potential to significantly
multiple sensors, such as LiDAR, radar, and cameras,
reduce human error-caused traffic accidents, improve road
to create an accurate representation of the environment.
safety, and save thousands of lives each year. In addition, they
They use sensor fusion techniques to combine data
can increase transportation efficiency, and reduce travel times,
and improve object detection. According to one study,
fuel consumption, and polluting emissions, contributing to
“Artificial intelligence (AI) algorithms are critical for
more sustainable development.
interpreting sensor data and enabling real-time environ-
Autonomous vehicles first made their appearance in 1925
mental sensing” [Valero-Matas and Delabarrera, 2020].
when Francis P. Houdina presented an automobile that
2) Navigation and Mapping Systems: Autonomous ve-
could be remotely controlled by radio frequency. This
hicles depend on advanced navigation systems that use
vehicle, known as the Chandler, traveled approximately
GPS, digital maps, and sensor data to determine their po-
19 km in New York before colliding with another vehicle
sition and plan routes. These systems are essential for the
[Geographic, 2024]. Some years later, in 1939, the designer
vehicle to navigate accurately in complex environments.
Norman Bel Geddes showed a concept of electric vehicles
It is mentioned that “embedded systems process large
controlled by integrated electric circuits at the New York
volumes of data to understand the vehicle’s environment
World’s Fair. This presentation is considered a milestone in the
and enable effective route planning” [Rastelli, 2012].
conceptualization of autonomous vehicles [Wetmore, 2003].
3) Actuator Controllers: These systems convert decisions
In the 1980s and 1990s, autonomous vehicles made a huge
made by embedded software into physical actions, such
leap in their development. An example of this is the Mercedes-
as steering wheel, brake, and throttle control. The litera-
Benz van developed by Ernst Dickmanns and his team at the
ture indicates that “actuators are responsible for execut-
University of Munich in 1980. This van could drive 100 km / h
ing the commands generated by the embedded systems,
on traffic-free streets using computer vision [Macarrón, 2021].
allowing the vehicle to respond to its environment”
Moreover, in 1994, the European Commission encouraged the
[Sonko et al., 2024].
Carlos Arronte, Department of Telecommunications and Control Engineer- 4) Safety and Collision Prevention Systems: Au-
ing, USP, São Paulo-SP, e-mail: carronte94@usp.br. tonomous vehicles incorporate systems that continu-
Final paper for the discipline "PSI5892 - Fundamentos de Adaptação e Aprendizado de Máquina (2024)"
ously analyze environmental data to identify potential actors (pedestrians, cyclists, other vehicles, etc.). This informa-
hazards and take preventive measures, such as braking tion will allow the vehicle to make accurate decisions so as not
or changing direction. One article highlights that “the to collide with objects or violate traffic laws. This application
ability to avoid collisions relies on rapid interpreta- has had different approaches in several published works.
tion of sensory data and real-time decision making” In [Farooq et al., 2023], for example, proposed a framework
[Zhang et al., 2023]. based on Deep Reinforcement Learning (DRL) using Scale
5) Vehicle-to-vehicle (V2V) communication: This tech- Invariant Faster Region-based Convolutional Neural Networks
nology allows vehicles to share information about their (SIFRCNN) technologies to efficiently detect pedestrian oper-
speed, direction, and other relevant data with each ations through which the vehicle, as agents train themselves
other, improving coordination in traffic. It is noted that from the environment and are forced to maximize the re-
“V2V communication is crucial to reduce the likeli- ward. Other algorithms used include Support Vector Machines
hood of collisions and improve overall traffic safety” (SVM) and Scale Aware Fast R-CNN, which are applied
[El Zorkany et al., 2020]. in common challenges such as motion planning and fault
6) Inertial Systems: Inertial sensors, such as accelerom- diagnosis in driving systems.
eters and gyroscopes, are used to track vehicle motion The purpose of this work is to develop an MLP (Multilayer
and orientation. This data is vital to maintaining accurate Perceptron) model to predict the speed and bearing of an
navigation, especially when GPS signals are unavailable autonomous vehicle with information from onboard systems
or inaccurate [Prikhodko et al., 2018]. such as GPS and IMU (Inertial Measurement Unit). Accurate
7) Machine Learning Algorithms: Embedded systems use prediction of speed and bearing in autonomous vehicles is
advanced machine learning algorithms to continuously essential to improve their navigation and decision-making
improve their performance by analyzing patterns in the capabilities in real-time, especially in scenarios where direct
data collected. This enables vehicles to adapt to different measurements can be noisy or unreliable. The use of MLP
driving conditions and improve their ability to make models, fed with data from on-board systems such as GPS
complex decisions [Moreno et al., 2023]. and IMU, allows optimizing sensor integration and moving
These embedded systems work together to enable autonomous towards more robust and efficient control of autonomous
vehicles to operate safely and efficiently in a variety of mobility.
environments, using real-time sensory information to make
informed decisions. II. M ETHODOLOGY
The methodology adopted in this work focuses on the
A. Machine Learning Algorithms in autonomous vehicles
design, training, and evaluation of a MLP (Multilayer Per-
Machine Learning (ML) algorithms are fundamental in ceptron) neural network model for the prediction of the speed
the development and operation of autonomous vehicles. and bearing of an autonomous vehicle. This section details the
They use algorithms such as Convolutional Neural Net- key stages of the development, including the collection and
works (CNN) for the detection and classification of objects preprocessing of data from onboard systems such as GPS and
around them. These algorithms allow the processing of images IMU, the configuration of the neural model architecture, and
and LiDAR data to identify features of the environment the parameters used during training. In addition, the validation
[Ravi et al., 2024]. This approach can be found in work such criteria used to ensure the accuracy and generalization of the
as [Tarmizi and Aziz, 2018] where a CNN is trained with model are described.
images of vehicles for detection in low light and/or bad
weather environments. The trained CNN achieved relevant
results in detecting vehicles at night and in snow. Other A. Data collection and preprocessing
authors have used derivations of these algorithms (such as For data collection, the “Sensor Logger” application is used,
[Wang et al., 2019]) to perform real-time classification of ve- which is available for free in the Google Play Store and
hicle types. This knowledge is fundamental for autonomous the Apple App Store. This application allows you to record
vehicle decision-making. In the cited work, a Faster R-CNN orientation, location, acceleration, etc. data directly from your
network (a variation of the CNN network) is used, obtaining cell phone. For data collection, 3 trips were made as shown
a prediction accuracy of more than 90% in all cases. in figure 1. In these trips, the following data were collected:
Other algorithms such as Reinforcement Learning algo- • qx, qy, qz, qw: Quaternions relating to vehicle motion.
rithms can be used to optimize control and decision mak- • yaw, roll, pitch: Euler angles of the vehicle [degrees].
ing in dynamic situations. This is often seen in the im- • altitude, longitude, latitude: Geographical coordinates of
plementation of speed control in vehicle tracking scenarios the car [degrees].
[Garikapati and Shetiya, 2024]. An example of the use of • bearingAccuracy: Bearing measurement accuracy [de-
these algorithms is [You et al., 2019]. Here reinforcement grees]
learning is used together with a stochastic Markov decision • speedAccuracy: Speed measurement accuracy [m/s]
process (MDP) to determine the optimal driving strategy for • verticalAccuracy, horizontalAccuracy: Accuracy of geo-
the autonomous vehicle. graphical position measurement [degrees]
Another interesting application of ML algorithms in au- • speed: Car speed [m/s]
tonomous vehicles is the prediction of the behavior of road • bearing: Car bearing [degrees]
Final paper for the discipline "PSI5892 - Fundamentos de Adaptação e Aprendizado de Máquina (2024)"
This data set will be used to train and validate the MLP model. this, it is perceived that there are missing and null data. In
these cases, the corresponding row within the document is
deleted. To simulate a prediction problem, the velocity and
bearing variables were shifted up one row in the data set so
that the current input values correspond to the predictions of
these parameters at the next time instant.
B. Data analysis
This section presents the preliminary data analysis, starting
with a correlation study to evaluate the relationship between
the variables in the data set and detect possible redundancies
or linear dependencies that may affect model performance.
Subsequently, principal component analysis (PCA) is applied
to reduce dimensionality and capture the most relevant char-
acteristics, maximizing the efficiency of the MLP model.
(a) Trip 1: Jabaquara - Santos. This analysis allows optimizing the data representation and
preparing a balanced and representative set for training.
1) Data correlation analysis: Having a large number of
inputs makes it interesting to perform a correlation analysis
of the input data. A correlation analysis is useful for the
elimination of redundancies. If there are variables that are
highly correlated with each other, it can be considered to
eliminate some of them to simplify the model. This not
only reduces the complexity of the model but can also im-
prove its performance by avoiding multicollinearity problems
[Pizarroso et al., 2022]. Figure 2 shows the correlation analy-
sis for the input data. It can be seen that the inputs “latitude”,
(b) Trip 2: Rio Pequeno - Butantã. “longitude” and “yaw” have a high correlation so it is decided
to eliminate them as input to the MLP network.
Fig. 3: PCA The weights of the layers are initialized using the default
PyTorch initialization (nn.Linear), which follows the He ini-
tialization method. This initialization ensures that the weights
shows that the optimum number of input components to reflect are drawn from a distribution with a variance scaled according
the desired variance is 5. to the number of input neurons, helping to prevent issues like
3) Data normalization: Feature scaling in training and vanishing or exploding gradients during training.
regression testing is crucial for accurate and reliable results. For optimization, the model uses the Adam optimizer with a
The purpose of scaling is to normalize the features, ensuring learning rate of 0.001, and training is performed using a Mean
that they are on a similar scale and have a comparable impact Squared Error (MSE) loss function. Training data is processed
on the model. Scaling the features also helps to improve in mini-batches of size 64, ensuring efficient parameter up-
the convergence of optimization algorithms, such as gradient dates. The training process incorporates early stopping with a
descent. When features have different scales, the optimiza- patience limit of 20 epochs to prevent overfitting. Finally, the
tion process may take longer to converge or may not even model’s performance is evaluated using a validation dataset,
converge at all [EITCA Academy, 2024]. For the scaling of and the best-performing model is saved for further use. Figure
the input and output characteristics, the equation (1) is used 4 shows the model implementation in Python.
through the MinMaxScaler function of the sklearn Python
library. Sklearn’s MinMaxScaler function performs a linear
D. Performance parameters
normalization of the data, transforming each feature to be in
a specific range, usually [0, 1]. In the case of the MLP regression model, key perfor-
mance metrics include the Mean Absolute Error (MAE), Mean
x − min(x) Squared Error (MSE), and the coefficient of determination
xscaled = (1) (R2 ). While MSE is commonly observed, MAE is particularly
max(x) − min(x)
important for direct comparison with the original data’s MAE
Finally, the data are split and saved in CSV format for (bearingAccuracy and speedAccuracy). As initially described,
training and validation of the model. The splitting is done these variables are obtained from the original dataset. Then the
so that the model is trained with 80% of the data, and 20% MAE of the output data will be, by definition, the average of
of the data is used to validate the model. bearingAccuracy and speedAccuracy. The loss curves for both
training and validation should show a consistent decline, with
the training loss gradually approaching a minimum. Validation
C. MLP structure and hyperparameters loss should decrease but eventually stabilize, with minimal
The developed model is a Multilayer Perceptron (MLP) divergence from the training curve. This indicates that the
implemented using PyTorch, designed for regression tasks model is generalizing well to unseen data. R2 should approach
with input data of 5 features (number of optimal PCs after 1, signifying that the model accounts for most of the variance
PCA) and two output variables representing the bearing and in the data.
speed of an autonomous vehicle. The architecture includes:
• Input layer: 5 features. III. R ESULTS
• Hidden layers: Two fully connected layers with 128, and The model was trained for a total of 500 epochs, with early
64 neurons respectively. stopping based on validation loss. During the training process,
• Output layer: 2 neurons (bearing and speed). the training loss decreased steadily, indicating that the model
• Dropout: Applied with a rate of 0.2 after the first and was learning effectively. The validation loss, plotted in Figure
second layers to reduce overfitting. 5, followed a similar trend, with minor fluctuations reflecting
• Activation function: ReLU for all layers except the output the model’s ability to generalize to unseen data.
layer. The Mean Squared Error (MSE) was consistently moni-
• Output layer: Provides two outputs corresponding to the tored, but more emphasis was placed on the Mean Absolute
target variables. Error (MAE) for performance evaluation, as it provides a
Final paper for the discipline "PSI5892 - Fundamentos de Adaptação e Aprendizado de Máquina (2024)"